Reported February 2023
Bloombergsorting

Bank Operating-Hours Coverage

Reported by candidates from Bloomberg's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.

Get StealthCoderRuns invisibly during the live Bloomberg OA. Under 2s to a working solution.
Founder's read

The mistake that sinks a first attempt on this Bloomberg OA, reported in February 2023, is checking whether one bank covers the transaction and stopping there. The problem says touching intervals merge, so coverage can come from three banks stitched together. It's a merge-intervals problem wearing a banking costume. Convert the HH:MM strings to minutes, sort, merge, then test containment. If you blank on the touching-endpoint rule during the live OA, StealthCoder is the silent hedge running on your desktop that the proctor can't see. But the pattern is short enough to own tonight.

The problem

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.

Reported by candidates. Source: FastPrep

Pattern and pitfall

The trick is sort plus merge. Parse each HH:MM into minutes since midnight, sort intervals by open time, then sweep. If the next interval's open is less than or equal to the current merged close, extend the close with the max. Use less-than-or-equal, not strictly less, because Example 1 merges 12:30 to 12:30 and 14:00 to 14:00. Then check whether any merged interval has open <= start and close >= end. Common pitfalls: comparing raw strings without care, using strict inequality so touching intervals break apart, and forgetting to take the max of closes when one interval is nested in another. You can also skip building the merged list and just track the merged block that contains start. Complexity is O(n log n) for the sort, fine for 10^5 intervals. If your mind goes blank mid-assessment, StealthCoder can surface this sweep so you just type it out.

Memorize the pattern. If you can't, run StealthCoder. The proctor sees the IDE. They don't see what's behind it.

If this hits your live OA

You can drill Bank Operating-Hours Coverage cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Made by an engineer who treats the OA as theater. If yours is tonight, you don't have time to grind. You have time to hedge.

Get StealthCoder

Related leaked OAs

⏵ The honest play

You've seen the question. Make sure you actually pass Bloomberg's OA.

Bloomberg reuses patterns across OAs. Made by an engineer who treats the OA as theater. If yours is tonight, you don't have time to grind. You have time to hedge. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Bank Operating-Hours Coverage FAQ

What's the trick in the Bloomberg bank operating-hours problem?+

Merge intervals. Convert times to minutes, sort by open, and merge when the next open is less than or equal to the current close. Touching counts as continuous. Then check if one merged block fully contains the transaction start and end.

How hard is this one really?+

Easy to medium. The algorithm is the standard merge intervals sweep. The difficulty is the touching rule and parsing. If you've done merge intervals once, you can finish this in a few minutes with clean code.

Do I need to merge everything or can I shortcut?+

You can shortcut. Sort, then sweep while tracking the current merged block. When a block ends, check if it contains the transaction. Stop early if it does. Merging all is simpler and still O(n log n).

What edge cases should I test before submitting?+

Test touching endpoints like 12:30 closing and 12:30 opening. Test a nested interval inside a bigger one. Test a transaction with start equal to end. Test a gap by one minute. Test an unsorted input, since the examples aren't ordered.

How do I prepare for this in 48 hours?+

Solve the classic merge intervals problem until the sort and sweep is automatic. Then practice a containment check on the merged result. Write the HH:MM to minutes helper from memory. That covers nearly everything this problem asks.

Problem reported by candidates from a real Online Assessment. Sourced from a publicly-available candidate-aggregated repository. Not affiliated with Bloomberg.

OA at Bloomberg?
Invisible during screen share
Get it