Data Structures & AlgorithmsModerateTCS NQT · CAT
Problem: How many integers from 1 to 100 inclusive are divisible by 7 but not by 14?
- A. 7
- B. 14
- C. 12
- D. 93
Correct answer: A. 7
Multiples of 7 up to 100: 14; the even ones (multiples of 14) number 7, leaving 7 odd multiples. 14 ignores the exclusion, subtracting multiples of 49 gives 12, and 93 counts numbers not divisible by 14.
More Coding Interview Problems questions
- Problem: What is the least common multiple of 6, 8 and 12?
- Problem: How many trailing zeros does 30! have in base 10?
- Problem: How many unordered pairs {x, y} with x ≠ y from the set {1, 2, 3, 4, 5} have x + y even?
- Problem: How many binary strings of length 4 contain no two adjacent 1s?
- Problem: How many two-digit numbers (10–99) have digits that sum to exactly 9?
- Problem: The undirected graph on vertices 0, 1, 2 has edges 0-1 (5), 1-2 (5) and 0-2 (12). What is the shortest path length from 0 to 2?