+ 5
Challenge : The Game Of Brackets!!! (Hard)
input any bracket ( (), [], {} ) like this (i dont know how to explain) and the system has to check wether the bracket "string" has an end or not ((({{[]}}))) is true but (()}[]{] is false when ypu put brackets, the need to have an end ( not (] but () ) its like you write a code. example in css : body { <== but you forget to put a bracket at the end, soo the system has to check it. p.s. we can write like this ()[]{} <= true if you still dont get it, comment below.
10 Answers
+ 15
+ 4
https://code.sololearn.com/ccPMgxab8h4d/?ref=app
+ 4
I *think* it works..:
https://code.sololearn.com/cjAdS2jqsXMd/?ref=app
+ 3
My attempt in Ruby.
Script stops running when encountering unexpected closing brackets, returns a message telling the user which type it was. At the end it lists the type and number of missing closing brackets,
if there were unclosed (, [, or {. Otherwise, it returns "VALID!"
https://code.sololearn.com/cFLN0DJHGJCR/?ref=app
+ 1
A simpler version in Ruby.
https://code.sololearn.com/c8HYLS80ua7R/?ref=app
A sharp-eyed Aris Kim noticed that my earlier version declared strings in the form ("Test"{"Test2")} as valid. This newer (and shortened) version catches the mismatch, and (hopefully) all others!
+ 1
Used some recursion to do this, which was fun learning.
https://code.sololearn.com/cCfwTD2E9w1p/?ref=app
+ 1
hey i changed my bracket validator version....
now it will NOT ONLY CHECK FOR VALIDITY BUT IT WILL TELL YOU
1) WHERE EXACTLY THE FAULT HAPPENED..
2) HOW TO RECOVER IT..
TRY IT OUT.....
https://code.sololearn.com/c1yCwEP85HQ2/?ref=app
0
https://code.sololearn.com/cbIbhC6pyZgw/?ref=app