Data Structures & AlgorithmsHardGATE CS · ICPC regional

How many valid (balanced) bracket sequences of length 8 are there using one type of bracket?

  1. A. 15
  2. B. 16
  3. C. 14
  4. D. 18

Correct answer: C. 14

Balanced sequences of 2n brackets are counted by the Catalan number C_n, here C4 = 14. Counting all 2^8 strings ignores the balance rule.

More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions

Exams that ask this topic