InterviewDB Experience

Minimum Health Required for Gaming: Survive a Sequence of Attacks with Minimum Starting HP

Interview Experience

Problem You are playing a game. You face n rounds in order. In each round, you either lose damage[i] HP or gain heal[i] HP (represented as negative damage). You die if your HP reaches 0 or below at any point. What is the minimum integer starting HP so you survive all rounds? Follow-ups What if you can choose the order of rounds — what ordering minimizes starting HP? How would you solve this if HP also has a maximum cap (e.g., cannot exceed 100)? Binary search is one approach. What is the invaria…

Full Details

🔒

Unlock all Confluent questions

Full insider details, leaked discussions, and candidate experiences.

Get full access — $100 a year, unlimited access

About This Question

This is a candidate experience report from a confluent interview during the oa round.

It covers the following topics: Coding, Oa, Binary Search, Matrix .