Little Girl, Tough Game

Limits: 1s, 1.0 GB

Samiya, a little girl, wrote a random sequence of opening brackets and closing brackets on a piece of paper with the pencil and wondered if she takes a subsection of the sequence and rearranges them if it’s possible to form a valid sequence.

This is a companion discussion topic for the original entry at