← Akuna Capital Interview Insights

Akuna Capital·Software Engineer·Technical Phone Screen·Intermediate

IntermediatePrefer not to say
May 2026

Summary

Interviewed for a software engineering role at Akuna Capital and got hit with a pretty involved algorithmic trading problem. The question had a lot of moving parts and felt more like a mini system design crossed with a classic DP problem than a straightforward coding question.

Questions Asked (1)

Q1

Given an unsorted list of (date, symbol, price) records for multiple stocks, design an algorithm to compute the maximum profit and a concrete trading plan. Constraints: hold at most one share at any time across all symbols, no same-day buy-and-sell, no short selling. Handle duplicate or missing dates. Return the max profit and the full sequence of trades with buy/sell dates, symbols, and prices. Prove correctness and analyze time and space complexity.

Algorithms & Data StructuresTechnical Trade-offsSystem Design
Author's notes

This one had layers I did not anticipate.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

First, clarify the problem constraints and edge cases (duplicate/missing dates, multiple symbols, one share at a time). Then, model the problem as finding the maximum profit sequence of non-overlapping transactions across all symbols, where each transaction is a buy on one day and a sell on a later day for the same symbol. Propose an algorithm that sorts records by date, processes them chronologically, and uses dynamic programming or a greedy approach with state tracking to select the optimal trades, then prove correctness and analyze complexity.

Pro tip: Emphasize that the problem is equivalent to finding the maximum profit from a set of non-overlapping intervals (buy-sell pairs) across different symbols, which can be solved by sorting and dynamic programming. Also, proactively discuss how to handle duplicate dates by aggregating or choosing the best price per symbol per day, and missing dates by treating them as no trading opportunity.

1. Clarify constraints and edge cases

Restate the problem: one share at a time, no same-day buy-sell, no short selling. Discuss how to handle duplicate dates (e.g., multiple records for same symbol/date) and missing dates (no action).

2. Model as maximum profit with non-overlapping transactions

Recognize that each trade is a buy on day d1 and sell on day d2 > d1 for the same symbol, and trades cannot overlap in time. The goal is to select a sequence of such trades maximizing total profit.

3. Design algorithm

Sort all records by date. Use dynamic programming where state is the maximum profit up to each day, considering either holding a stock (with its buy date and symbol) or being in cash. For each day, evaluate selling the held stock or buying a new one, ensuring no same-day buy-sell.

4. Prove correctness and analyze complexity

Argue that the DP considers all valid sequences and picks the optimal. Time complexity: O(N log N) due to sorting, plus O(N) DP steps; space O(N) for DP table or O(1) with rolling variables.

5. Reconstruct trading plan

During DP, store decisions (buy/sell actions) to backtrack and output the full sequence of trades with dates, symbols, and prices.

Key Points to Mention

  • Handling duplicate dates: aggregate by taking the best price per symbol per day, or consider all but ensure no same-day buy-sell.
  • Missing dates: treat as days with no trading opportunities; they don't affect the DP except for chronological ordering.
  • State definition in DP: cash (no stock held) vs. holding a stock (with buy date and symbol).
  • Transition: from cash, can buy any stock on that day; from holding, can sell on a later day (not same day) or continue holding.
  • Proof of optimality: induction on days, showing DP considers all valid sequences and picks max profit.
  • Complexity: O(N log N) time due to sorting, O(N) space for DP and reconstruction.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.