Skip to main content
All Questions

An array lists a company's income and expenses in order. What is the fewest expenses you must move to the end so that the running balance never goes negative?

Unlock detailed company stats for this questionUpgrade
An array records a company's income (positive) and expenses (negative) over time, and the running balance may never be negative. You may move expenses to the end of the year. What is the fewest expenses you must move? The total of the array is at least 0 and n is at most 100,000.

Community answers

No answers contributed by the community yet.

Related courses

Course

Behavioral Interviews: A Practical Guide for Engineers

Get offers at the level you deserve. Prep for senior+ behavioral interviews at FAANG and Tier-1 companies. Made with staff and principal engineers from Meta, Netflix, Google, and more. Avoid downleveling, elevate past projects, and stop sounding like a robot.

Course

Software Engineering Interview Prep

Land your dream software engineering role at Google, Amazon, Microsoft, Meta, Apple, and other top companies. Learn from mock interviews, frameworks, and advice from senior candidates—practice data structures, algorithms, system design, people management, behavioral interviews, and more.