GATE Computer ScienceHardGATE CSE

Over {a, b, c}, let L = {aⁱbʲcᵏ : i = j} ∪ {aⁱbʲcᵏ : j = k} (i, j, k ≥ 0). How many strings of length at most 12 belong to L?

  1. A. 98
  2. B. 88
  3. C. 105
  4. D. 93

Correct answer: D. 93

Each part has 49 strings of length ≤ 12; the overlap is {aⁿbⁿcⁿ} with n = 0..4, i.e. 5 strings; by inclusion–exclusion 49 + 49 − 5 = 93.

More Theory of Computation questions

Exams that ask this topic