FastPrepBank Operating-Hours Coverage

Bank Operating-Hours Coverage

Bloomberg LP logoBloomberg LP● MediumNEW GRADPHONE SCREENONSITE INTERVIEW
Learn

Problem statement

You are given bank operating intervals operatingHours[i] = [open, close] and one transaction interval [start, end]. Each time is a 24-hour HH:MM string.

Different banks may collectively cover one transaction: overlapping or touching operating intervals form continuous coverage. Return whether the entire transaction interval lies inside one merged coverage interval.

Function

isTransactionCovered(operatingHours: String[][], transaction: String[]) → boolean

Examples

Example 1

operatingHours = [["04:20","12:30"],["19:00","21:45"],["14:00","17:30"],["12:30","14:00"]]transaction = ["11:00","17:30"]return = true

The first, fourth, and third intervals touch and merge into coverage from 04:20 through 17:30.

Example 2

operatingHours = [["09:00","12:00"],["13:00","17:00"]]transaction = ["11:30","13:30"]return = false

The uncovered hour between noon and 13:00 interrupts the transaction.

Constraints

  • 1 <= operatingHours.length <= 10^5.
  • Every time is a valid same-day 24-hour time and each interval has start no later than end.
  • All times use the same timezone.

More Bloomberg LP problems

See Bloomberg LP hiring insights
public boolean isTransactionCovered(String[][] operatingHours, String[] transaction) {
  // Write your code here.
}
operatingHours[["04:20","12:30"],["19:00","21:45"],["14:00","17:30"],["12:30","14:00"]]
transaction["11:00","17:30"]
expectedtrue
Checking account…