Data Structures & AlgorithmsHardCodeforces Div2 C · GATE CS
How many substrings of "abcabc" are anagrams of "abc" (that is, have the same letters with the same counts)?
- A. 5
- B. 3
- C. 2
- D. 4
Correct answer: D. 4
Sliding window of length 3 with a count vector: each window whose multiset of letters equals a, b, c qualifies. Two windows qualify in this string.
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 total number of 1-bits in the binary representations of all integers from 0 to 31 inclusive?
- How many integers from 1 to 100 inclusive are perfect squares or perfect cubes?
- What is the minimum number of single-character replacements needed to make "abcdba" a palindrome?
- How many well-formed strings of 3 pairs of parentheses (length 6) exist?
- On a line with cells 1 to 10, a lamp at position p lights cells p-2 to p+2. Lamps are placed at positions 1, 4, 6, 9. Do they light every…
- The histogram heights [1, 3, 3, 2, 3] describe bars of width 1. What is the area of the largest rectangle that fits under the histogram?