Data Structures & AlgorithmsHardGATE CS · TCS NQT
How many length-3 substrings of "abcabc" are rotations of "abc" (namely abc, bca or cab)?
- A. 5
- B. 4
- C. 3
- D. 2
Correct answer: B. 4
Every length-3 window of abcabc is one of the three rotations, and there are four windows, so the count is 4.
Practise more Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questionsArrays, Strings, Linked Lists, Stacks, Queues and Hashing: notes and key points
More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions
- What is the sum of the decimal digits of 2^20?
- Among intervals [1,6], [4,9], [5,5], [2,8], [5,7], [3,6] that contain the point 5, what is the largest number that are pairwise disjoint…
- How many index pairs i < j in [2, 3, 4, 5, 8, 9] have an odd sum?
- How many integers from 1 to 999 inclusive have all decimal digits distinct?
- Using coins of value 5, 2 and 1, what is the minimum number of coins that make the amount 11?
- How many positive integers x satisfy x^2 <= 500?