Data Structures & AlgorithmsHardGATE CS · TCS NQT
How many distinct rotations does the string aabaab have (including itself)?
- A. 4
- B. 5
- C. 3
- D. 7
Correct answer: C. 3
aabaab has period 3, so rotations by 0 and 3 coincide and so on; only 3 different rotations remain.
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 all positive divisors of 28, a perfect number?
- How many integers in [1, 100] have exactly two distinct prime factors (counted without multiplicity)?
- What is the digital root of 98765 (repeatedly sum the digits until one digit remains)?
- How many ways are there to climb exactly 6 stairs taking steps of size 1, 2 or 4 (different orders of steps count as different ways)?
- How many integers x in [1, 200] have x^2 mod 10 equal to 4?
- Five people stand in a circle numbered 1 to 5. Starting from person 1, every third person is removed until one remains. Who survives?