Data Structures & AlgorithmsVery hardICPC regional · Amazon SDE OA
How many integers from 1 to 60 inclusive are multiples of 3 or of 4 but not of 12?
- A. 26
- B. 30
- C. 25
- D. 5
Correct answer: C. 25
The union of multiples of 3 or 4 has 20 + 15 - 5 = 30 elements; removing the 5 multiples of 12 leaves 25.
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 common prefix of "interview", "internet" and "interval"?
- What is the smallest positive integer x such that x^2 + x is at least 1000?
- How many index pairs i < j in [1, 4, 6, 3, 2] satisfy a[i] XOR a[j] < min(a[i], a[j])?
- In "xxyxxzxxx", what is the length of the longest substring that contains at most one character other than 'x'?
- How many index pairs i < j of [1, 2, 3, 4, 5] have a sum equal to the array's maximum?
- Keeping only a palindrome (as a subsequence) of "abcba" needs no deletion at all, since the string is a palindrome already. What is the…