Data Structures & AlgorithmsHardProduct Company SDE · ICPC regional
Problem: Split the array [7, 2, 5, 10, 8] into 2 contiguous non-empty parts so that the largest part sum is as small as possible. What is that minimum possible largest sum?
- A. 16
- B. 23
- C. 14
- D. 18
Correct answer: D. 18
Splits give max sums 25, 23, 18, 24, so the best is [7,2,5] | [10,8] = 18. Half the total (16) is a lower bound that cannot be reached, a 2 | 3 length split gives 23, and 14 is the smaller part.
More Coding Interview Problems questions
- Problem: A 3×3 spiral is filled starting with 1 at the top-left and moving right, then down, then left, then up, spiralling inward. What…
- Problem: Count the unordered pairs (x, y) with 1 ≤ x < y ≤ 7 for which x OR y equals 7.
- Problem: In base 8, how many trailing zeros does 100! have?
- Problem: What is the sum of the divisors of 360 that are perfect squares?
- Problem: How many integers from 1 to 200 are both perfect squares and perfect cubes?
- Problem: Compute 7^2024 modulo 9.