Data Structures & AlgorithmsModerateTCS NQT · Accenture

Problem: In the string "dvdf", what is the length of the longest substring with all distinct characters?

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

Correct answer: C. 3

The longest run of distinct characters is 'vdf', of length three; the full string repeats 'd' and so is not valid.

More Coding Interview Problems questions

Exams that ask this topic