Data Structures & AlgorithmsModerateTCS NQT · SSC CGL Tier 2
Problem: The array [4, 9, 16, 25] has its square roots summed. What is the sum of the square roots of these four numbers?
- A. 54
- B. 7
- C. 14
- D. 9
Correct answer: C. 14
√4 + √9 + √16 + √25 = 2 + 3 + 4 + 5 = 14. Adding the values gives 54, the square root of their sum is about 7, and missing √25 gives 9.
More Coding Interview Problems questions
- Problem: A grid has 5 cells in a row, each painted red or blue. How many colourings have no two adjacent cells of the same colour?
- Problem: What is the largest integer n such that n! has at most 3 trailing zeros in base 10?
- Problem: The matrix [[2,0],[0,3]] is raised to the power 4 (matrix power). What is the sum of all entries of the result?
- Problem: A word is "statistics". How many distinct letters appear at least twice in it?
- Problem: A sorted array [2, 3, 5, 7, 11, 13, 17, 19] is searched for 11 using binary search with mid = (lo + hi) // 2 over the inclusive…
- Problem: Consider the string "xyzzyzyx". How many distinct substrings of length 2 are there?