Data Structures & AlgorithmsHardCodeforces Div2 B · GATE CS

What is the length of the longest substring of abcabcbbxyzw that contains no repeated character?

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

Correct answer: D. 5

Keep a sliding window and jump the left boundary past the previous occurrence of the new character only when that occurrence lies inside the window.

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

Exams that ask this topic