+ 16
Challenge::Expression Validity
Write a program that takes an expression containing brackets as input and outputs whether the expression is valid or not Example: input:(){}[] output:Valid input:{[()]} output:Valid input:{([)]} output:Invalid input:}{}] output:Invalid Happy coding! Any language is welcomed..đđđ
15 Answers
+ 15
My try without Stack
https://code.sololearn.com/cQBtjRN3yfMB/?ref=app
+ 10
https://code.sololearn.com/cU0SEGA7PQ7A/#cpp
+ 10
Here's my solution.
https://code.sololearn.com/czVKD72HCybD/?ref=app
+ 5
+ 4
Easier with regexp + replace.
https://code.sololearn.com/W8WcMPIvwjrG/#js
+ 4
Now with one liner version
https://code.sololearn.com/cJL6EMVHe0jB/?ref=app
+ 3
Here's mine
https://code.sololearn.com/W94Z6iTfY7zz/?ref=app
+ 2
even shorter than shorter
https://code.sololearn.com/cJL6EMVHe0jB/?ref=app
+ 1
its a brace validator..with possible mentions of where the string you had given went wrong...try it with worst inputs...
https://code.sololearn.com/c1yCwEP85HQ2/?ref=app
+ 1
Here's:
#one liner now
https://code.sololearn.com/cyQrxKeuMf95/?ref=app
+ 1
@luis great idea but does not work for ([)]
+ 1
ya....luis...theres more with validation...count cant handle it...
both count are equal - is just an element of set with all "to be checked" criterias....
+ 1
Ok I'll fix it
Now it's fixed
+ 1
Mine, nice challenge!
https://code.sololearn.com/c27X64Di2RYz/?ref=app
+ 1
@md who s winning this challenge ?