Coding Challenge #4: Validate Parantheses (Code included) | Sololearn: Learn to code for FREE!

+11

Coding Challenge #4: Validate Parantheses (Code included)

Parentheses Validation (By: cheeze) Create a function validate() that accepts a string of parentheses as an argument and validates whether the parentheses are balanced. e.g. validate("()()(()())") // true e.g. validate("())(()") // false e.g. validate("()((()))") // true EDIT: For those who want something more challenging, check out Burey's code here, validating ({[]}) with an expression and try to do that. Thanks for posting it here Burey 😊 https://code.sololearn.com/cuxC4syg7208/?ref=app

5/14/2017 7:03:38 PM

Pixie

16 Answers

New Answer

+10

https://code.sololearn.com/cUBsGXRMuKZ1/?ref=app

+12

I kinda of abandoned my coding challenges, but they will come back soon :)

+12

@Pixie I think I fixed it now.. Thank you for the best answer, but I think @Burey deserves it :)

+12

@Burey *_*

+10

xD i have done that long ago https://code.sololearn.com/WKyZXYO8hsH5/?ref=app [edit] made some updates to the parser go check it out

+10

i don't do it for best answer >:D is fun that's all :) give it to someone worthy thy lord (.)_(.)

+10

@Gami Burey's code is very good but you posted it first, and also for the challenge. You deserve it 😉. In fact, I added what Burey did as the harder version of the challenge. Try to do it if you can ☺

+9

@Gami "))((" is given as true. It should be false

+9

@Burey. "I did that long ago" So..... idk whether to give the best answer to you or not, cause your code also checks for {} and [] as well 😮 and it is really good but you didnt do it for the challenge 😓 In fact, I'll add your post as the harder version of the challenge. 😎

+9

go Gami go >:D

+8

Thanks @Sagheb. Try to solve it if you can ☺

+8

My answer https://code.sololearn.com/c1s1Jg2qlBZN/?ref=app

+5

https://code.sololearn.com/czdKJgoni0L9/#java

+4

https://www.sololearn.com/discuss/437489/?ref=app

+3

Oh this one is nice. Appreciate for putting your solution too.

+3

https://www.sololearn.com/discuss/391764/?ref=app