Data Structures & AlgorithmsVery hardICPC regional · strings

Problem: What does the Booth's algorithm compute?

  1. A. The longest palindromic substring
  2. B. The lexicographically smallest rotation of a string in linear time
  3. C. The shortest path in a grid
  4. D. The number of divisors of an integer

Correct answer: B. The lexicographically smallest rotation of a string in linear time

Booth's algorithm uses a modified failure function to find the least rotation in O(n).

More Coding Interview Problems questions

Exams that ask this topic