Problem · Array

Maximum Concurrent Active Loans

Learn this problem
MediumTekion logoTekionFULLTIMEPHONE SCREEN

Problem statement

Each funded loan is active during a half-open time interval [start, end): the start time is included and the end time is excluded.

Given all loan intervals, return the maximum number of loans active at the same time.

Function

maxActiveLoans(loans: int[][]) → int

Examples

Example 1

loans = [[1,5],[2,6],[4,8],[7,9]]return = 3

At time 4, the first three loans are active simultaneously.

Constraints

  • 1 <= loans.length <= 10^5
  • Every row has exactly two values [start, end].
  • 0 <= start < end <= 10^9
  • A loan ending at time t does not overlap a loan starting at time t.

More Tekion problems

drafts saved locally
public int maxActiveLoans(int[][] loans) {
    // Write your solution here.
}
loans[[1,5],[2,6],[4,8],[7,9]]
expected3
checking account