Merge Overlapping Trading Halts Per Symbol

Last updated: November 29, 2026

Quick Overview

Given a list of trading halts as (symbol, start_minute, end_minute) records, possibly overlapping or duplicated across sources, merge them per symbol into disjoint intervals and report total halted minutes per symbol.

Akuna Capital
Coding & Algorithms
Software Engineer
Akuna Capital
November 29, 2026
Software Engineer
Phone Screen
Coding & Algorithms
Easy

0

0

0 solved


Given a list of trading halts as (symbol, start_minute, end_minute) records, possibly overlapping or duplicated across sources, merge them per symbol into disjoint intervals and report total halted minutes per symbol.

Akuna Capital trades listed options across many underlyings, and halts or limit-up limit-down pauses change what the quoting engine is allowed to do. In a phone screen this checks whether you can sort and merge intervals cleanly and state boundary conventions out loud.

What the Interviewer Expects
  • Group records by symbol before merging
  • Sort by start and merge when the next start is at or before the current end
  • State whether touching intervals merge (half-open ranges make this natural)
  • Drop empty or inverted intervals
  • Compute totals from the merged result, not the raw data
Key Topics to Cover
intervals
sorting
hashing
sweep line
How to Approach This
  1. Clarify input constraints and edge cases before writing code.
  2. Walk through your approach verbally and confirm with the interviewer before coding.
  3. Start with a brute force solution, then optimize. Mention time and space complexity.
  4. Test your solution with examples, including edge cases like empty input or duplicates.
  5. Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
  • How would you answer "is SPY halted at minute t" for many queries?
  • How do you handle halts that arrive out of order in a live stream?
  • What if two sources disagree on the end time of the same halt?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice DSA Problems
Sample Answer
Requirements

Each halt is half-open [start, end) in minutes since the open. Overlapping or touching halts for the same symbol become one interval. Output: a dict symbol -> sorted disjoint intervals, plus total hal...

High-Level Design

Bucket records into a dict keyed by symbol. For each symbol, sort intervals by start and do a single pass: if the next interval starts at or before the current merged end, extend the end with max; oth...


Submit Your Answer
Markdown supported

Related Questions