Choose Non-Overlapping Hedge Windows for Maximum Edge

Last updated: November 29, 2026

Quick Overview

You are given candidate hedge trades, each occupying a time window [start, end) and carrying an expected edge. Only one can be active at a time. Pick a non-overlapping subset with maximum total edge and return the chosen trades.

Akuna Capital
Coding & Algorithms
Quantitative Researcher
Akuna Capital
November 29, 2026
Quantitative Researcher
Onsite
Coding & Algorithms
Hard

0

0

0 solved


You are given candidate hedge trades, each occupying a time window [start, end) and carrying an expected edge. Only one can be active at a time. Pick a non-overlapping subset with maximum total edge and return the chosen trades.

Akuna Capital asks quant and developer candidates DP problems framed as trading decisions, and this is weighted interval scheduling in disguise. The interviewer wants you to see why greedy fails, define the DP over trades sorted by end time, use binary search for the compatible predecessor, and reconstruct the choice.

What the Interviewer Expects
  • Show a counterexample to greedy by earliest end or highest edge
  • Sort by end time and define dp[i] over the first i trades
  • Find the last compatible trade with binary search
  • Reconstruct the chosen set, not just the value
  • State O(n log n) time
Key Topics to Cover
dynamic programming
weighted interval scheduling
binary search
greedy counterexamples
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
  • What if up to two trades can be active at once?
  • What if trades also consume a shared risk budget?
  • How would you solve this online as candidate trades stream in?
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

Input: list of (start, end, edge) with half-open windows, so a trade ending at 3 is compatible with one starting at 3. Output: (max total edge, chosen trades in time order). Edges are non-negative....

High-Level Design

Greedy fails: picking highest edge first takes (0, 7, 10) and blocks 5 + 9 = 14. Sort by end time. Let dp[i] be the best total using only the first i trades. For trade i, either skip it (dp[i-1]) or t...


Submit Your Answer
Markdown supported

Related Questions