Data Structures & AlgorithmsModerateCAT · TCS NQT
Problem: How many integers from 1 to 200 are both perfect squares and perfect cubes?
- A. 2
- B. 3
- C. 1
- D. 4
Correct answer: A. 2
A number that is both a square and a cube is a sixth power. Only 1 and 64 are sixth powers up to 200, so the count is 2.
More Coding Interview Problems questions
- Problem: Compute 7^2024 modulo 9.
- Problem: What is the multiplicative inverse of 3 modulo 11 (the value x with 0 ≤ x < 11 and 3x ≡ 1 mod 11)?
- Problem: The k = 2 closest points to the origin are chosen from the list (1,3), (−2,2), (5,8), (0,1). Compute the sum of the squared…
- Problem: Intervals [1,4], [3,7] and [6,10] are available. What is the minimum number of these intervals needed to cover the whole segment…
- Problem: Starting from x = 7, apply six times the rule: if x is even, x = x/2 (integer), otherwise x = 2x + 3. What is the final value of x?
- Problem: The words of "the sky is blue" are put in reverse order and joined by single spaces to form a new string. How many characters…