Challenge : The Game Of Brackets!!! (Hard) | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
+ 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.

9th Aug 2017, 2:51 PM
Domces Games
Domces Games - avatar
10 ответов
9th Aug 2017, 5:57 PM
Krishna Teja Yeluripati
Krishna Teja Yeluripati - avatar
+ 4
https://code.sololearn.com/ccPMgxab8h4d/?ref=app
9th Aug 2017, 3:36 PM
Dennis
Dennis - avatar
9th Aug 2017, 5:13 PM
Steve Roche
Steve Roche - avatar
9th Aug 2017, 7:46 PM
Karbz P
Karbz P - avatar
+ 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
9th Aug 2017, 7:23 PM
André
André - avatar
+ 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!
9th Aug 2017, 10:00 PM
André
André - avatar
+ 1
Used some recursion to do this, which was fun learning. https://code.sololearn.com/cCfwTD2E9w1p/?ref=app
10th Aug 2017, 6:58 PM
NoTranslation
NoTranslation - avatar
+ 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
13th Aug 2017, 4:17 AM
sayan chandra
sayan chandra - avatar
0
https://code.sololearn.com/cbIbhC6pyZgw/?ref=app
15th Aug 2017, 12:57 PM
VcC
VcC - avatar