Data Structures & AlgorithmsVery hardTCS NQT · Accenture
How many windows of length 3 in the string abaaabaa are anagrams of aab (same letters with the same counts)?
- A. 6
- B. 7
- C. 9
- D. 5
Correct answer: D. 5
Compare the sorted window with sorted aab; a window must contain exactly two a's and one b.
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 length of the longest substring of aabaaccaa that contains at most two letters 'a'?
- How many palindromic substrings (counted by position) does the string abbaabba contain?
- How many distinct palindromic substrings does the string aabaa contain?
- What is the smallest integer x greater than 100 with x congruent to 3 modulo 7 and x congruent to 5 modulo 11?
- How many integers in [1, 200] are coprime to 210?
- What is the sum of all integers in [1, 50] that are either perfect squares or perfect cubes?