This is a verified interview question from Titan. Candidates reporting seeing this problem in recent Online Assessments (OAs) and onsite rounds. Mastering "Minimum Time to Kill Monsters: Titan Online Assessment MNNIT Allahabad" covers key patterns like Arrays.
"You are fighting N monsters. The i-th monster has H[i] health points. You have K attacks available per second. In every second, you can distribute these attacks among the monsters. Each attack decreases the health of one monster by 1. A monster is killed when its health becomes 0. Determine the minimum number of seconds required to kill all monsters. Input Format The first line contains two integers: N K The second line contains N integers: H[1] H[2] ... H[N] Output Format Print the minimum number of seconds required to kill all monsters. Constraints 1 ≤ N ≤ 2 × 10^5 1 ≤ K ≤ 10^9 1 ≤ H[i] ≤ 10^9 Example Input: 3 4 5 3 6 Output: 4 Explanation: Total health: 5 + 3 + 6 = 14 You can perform 4 attacks per second, so at least: ceil(14 / 4) = 4 seconds are required. It is possible to distribute the attacks so that all monsters are killed within 4 seconds. Therefore, the answer is: 4"
Join thousands of developers practicing for Titan.