Data Structures & AlgorithmsModerateTCS NQT · Accenture

Problem: The string "abcabcabcabc" is split into consecutive chunks of length 5 from the left (the last chunk may be shorter). How many chunks are there?

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

Correct answer: B. 3

Twelve characters split into chunks of five give two full chunks and one of length two, so three chunks in total.

More Coding Interview Problems questions

Exams that ask this topic