RosettaCodeData/Task/Balanced-brackets/00DESCRIPTION

16 lines
559 B
Text
Raw Permalink Normal View History

2013-04-10 12:38:42 -07:00
'''Task''':
2016-12-05 22:15:40 +01:00
* Generate a string with &nbsp; '''N''' &nbsp; opening brackets &nbsp; <big>'''['''</big> &nbsp; and with &nbsp; '''N''' &nbsp; closing brackets &nbsp; <big>''']'''</big>, &nbsp; in some arbitrary order.
2013-04-10 12:38:42 -07:00
* Determine whether the generated string is ''balanced''; that is, whether it consists entirely of pairs of opening/closing brackets (in that order), none of which mis-nest.
2016-12-05 22:15:40 +01:00
;Examples:
2018-06-22 20:57:24 +00:00
(empty) OK
[] OK
[][] OK
[[][]] OK
][ NOT OK
][][ NOT OK
[]][[] NOT OK
2016-12-05 22:15:40 +01:00
<br><br>