Bursting Balloons Problem

Given an array ARR of size N, where each element represents the height of a balloon. The task is to destroy all balloons by shooting arrows from left to right. When an arrow hits a balloon, it continues its path at a height decreased by 1. Determine the minimum number of arrows needed to burst all balloons.

Input:

The first line of input contains an integer N, denoting the size of the array.
The second line of input contains N space-separated integers representing the heights of the balloons.

Output:

Return a single integer, which is the minimum number of arrows required to burst all balloons.

Example:

Input:
N = 5
ARR = [2, 3, 4, 5, 1]
Output:
3

Constraints:

  • 1 <= N <= 5*105
  • 1 <= ARR[i] <= 109
  • Time Limit: 1sec

Note:

You are not required to print the output; it is already managed. Just implement the function.
AnswerBot
4mo

To burst all balloons by shooting arrows from left to right, determine the minimum number of arrows needed.

  • Iterate through the array and keep track of the maximum height of balloons that can be burst ...read more

Help your peers!
Select
Add answer anonymously...

Deloitte Business Technology Analyst interview questions & answers

A Business Technology Analyst was asked 9mo agoQ. How do you clone a database?
A Business Technology Analyst was asked 9mo agoQ. How do you find and resolve block level corruption?
A Business Technology Analyst was asked 9mo agoQ. How do you use LogMiner?

Popular interview questions of Business Technology Analyst

A Business Technology Analyst was asked 9mo agoQ1. How do you clone a database?
A Business Technology Analyst was asked 9mo agoQ2. How do you find and resolve block level corruption?
A Business Technology Analyst was asked 9mo agoQ3. How do you use LogMiner?

Top HR questions asked in Deloitte Business Technology Analyst

A Business Technology Analyst was asked 9mo agoQ1. How did you come to know about Deloitte?
A Business Technology Analyst was asked Q2. Explain your experience and projects.
A Business Technology Analyst was asked Q3. What did you learn in your engineering course?
Deloitte Business Technology Analyst Interview Questions
Stay ahead in your career. Get AmbitionBox app
play-icon
play-icon
qr-code
Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+

Reviews

10L+

Interviews

4 Cr+

Salaries

1.5 Cr+

Users

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2025 Info Edge (India) Ltd.

Follow Us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter
Profile Image
Hello, Guest
AmbitionBox Employee Choice Awards 2025
Winners announced!
awards-icon
Contribute to help millions!
Write a review
Write a review
Share interview
Share interview
Contribute salary
Contribute salary
Add office photos
Add office photos
Add office benefits
Add office benefits