This is a verified interview question from Code-with-cisco. Candidates reporting seeing this problem in recent Online Assessments (OAs) and onsite rounds. Mastering "Train Reservation Reroute Auditor." covers key patterns like Other.
"Given a list of events, find the earliest event index t such that the cumulative sum of the values of the events up to t is greater than or equal to the threshold. The events are represented as a list of pairs, where the first element of the pair is the value of the event and the second element is the index of the event. The threshold is given as a parameter. The function should return the index of the threshold event, or -1 if no such event exists. "
Join thousands of developers practicing for Code-with-cisco.