Back to problems

Count Maximum Borrowing Days

Algorithm · Point72 · Hard

A borrower starts broke and tries to survive as many days as possible. Each day they pick one lender, get an upfront amount, and must settle any debt from the prior day before pocketing what is left. The day ends with zero cash, and the new loan creates a payback obligation for the next day. There are n lenders. Each lender i provides lend[i] today and demands payback[i] tomorrow. A lender can be used at most once. On day 1 there is no existing debt. To survive a day, the…

Checking your access…