Data Structures & AlgorithmsHardCodeforces Div2 C · GATE CS

What is the length of the longest common prefix of "interview", "internet" and "interval"?

  1. A. 6
  2. B. 4
  3. C. 7
  4. D. 5

Correct answer: D. 5

The common prefix is "inter", of length 5, since the next letters differ (v, n, v).

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

Exams that ask this topic