Balanced brackets: Difference between revisions

Content added Content deleted
m (→‎with 40 examples: changed the wording in the output section.)
m (used highlighting instead of quoted strings in the task requirements.)
Line 1: Line 1:
{{task}}
{{task}}

'''Task''':
'''Task''':
* Generate a string with <math>\mathrm{N}</math> opening brackets (“<code>[</code>”) and <math>\mathrm{N}</math> closing brackets (“<code>]</code>”), in some arbitrary order.
* 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.
* 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.
* 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.