Data Structures & AlgorithmsVery hardGATE CS · ICPC regional
How many distinct values does floor(30 / k) take as k ranges over 1 to 30?
- A. 11
- B. 10
- C. 12
- D. 14
Correct answer: B. 10
The values of floor(n/k) take only about 2 sqrt(n) distinct values, which is why blocks of equal quotients can be summed quickly.
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
- How many triples a < b < c with a, b, c in [1, 10] satisfy a + b = c?
- What is the minimum number of characters that must be deleted from aabbaa so that no two adjacent characters of the remaining string are…
- How many distinct strings can be obtained from aabb by removing exactly one character?
- What is the sum of the decimal digits of 100!?
- How many trailing zeros does 1000! have in base 10?
- How many integers x in [1, 300] satisfy x ≡ 1 (mod 4) and x ≡ 2 (mod 3)?