Data Structures & AlgorithmsHardCodeforces Div2 C · GATE CS
How many distinct characters occur at least twice in "programming"?
- A. 4
- B. 2
- C. 5
- D. 3
Correct answer: D. 3
In "programming", r, g and m each appear twice, while o, a, i and n appear once, so three letters repeat.
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
- With 1-based indexing, what is the sum of i times a[i] for a = [2, 0, 3, 1]?
- For [1, 0, 1, 1, 0, 1, 0, 1], consider windows of length 4. In each window you may flip at most one 0 to 1. What is the largest number of…
- Over all windows of size 3 in [4, 8, 2, 7, 5, 9], what is the smallest value of (window max minus window min)?
- How many index pairs i < j of length-2 substrings of "ababa" are equal strings?
- What is the smallest positive integer x such that floor(x/2) + floor(x/3) is at least 10?
- In [3, 8, 1, 8, 5], you move the rightmost occurrence of the maximum to the last position using adjacent swaps. How many adjacent swaps…