← Akuna Capital Interview Insights

Akuna Capital·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
Apr 2026

Summary

Akuna Capital software engineer interview with a meaty low-level systems question. The kind of problem that sounds straightforward until you're actually in it and realize how many edge cases you glossed over in your head.

Questions Asked (1)

Q1

Implement a fixed-capacity circular buffer using an array, supporting push, pop, peek, isEmpty, isFull, and size, all in O(1) time. You also need to define what happens when you push to a full buffer, support iteration in logical order, and discuss how you'd make it thread-safe with blocking push/pop using condition variables.

Algorithms & Data StructuresSystem DesignTechnical Trade-offs
Author's notes

I knew the ring buffer mechanics well enough but tripped up when they asked me to commit to a policy for full-buffer pushes and actually document it.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements and edge cases (e.g., full buffer behavior), then implement the core circular buffer with head, tail, and size using modulo arithmetic. After ensuring O(1) operations and iteration, discuss thread-safety using mutex and condition variables for blocking push/pop. Emphasize trade-offs and design choices throughout.

Pro tip: Explicitly state your assumption for full-buffer push (e.g., overwrite oldest or throw exception) and justify it based on use case; this shows you think about real-world constraints and API design.

1. Clarify requirements and edge cases

Ask about the expected behavior when pushing to a full buffer (overwrite, block, or error) and whether iteration should be thread-safe. Confirm that all operations must be O(1) and discuss initial capacity handling.

2. Design the core data structure

Use a fixed-size array with head (read index), tail (write index), and size (or count) variables. Explain how modulo arithmetic enables wrap-around and maintains O(1) for push, pop, peek, isEmpty, isFull, and size.

3. Implement iteration in logical order

Describe how to iterate from head to tail using modulo indexing, ensuring elements are visited in FIFO order. Mention that iteration is O(n) but each step is O(1).

4. Add thread-safety with blocking operations

Introduce a mutex to protect shared state and condition variables (not_empty, not_full) to block push when full and pop when empty. Explain how to signal/wait to avoid busy-waiting and ensure correctness.

5. Discuss trade-offs and alternatives

Compare overwrite vs. block vs. error on full push, and mention alternative implementations (e.g., linked list) and their trade-offs. Highlight that the array-based approach gives O(1) operations and cache efficiency.

Key Points to Mention

  • Use of head, tail, and size (or count) variables to track state and enable O(1) operations.
  • Modulo arithmetic for wrap-around indexing.
  • Explicit policy for full-buffer push (e.g., overwrite oldest, throw exception, or block) and its implications.
  • Iteration in logical order using head and size, with modulo indexing.
  • Thread-safety using a mutex and condition variables for blocking push/pop.
  • Trade-offs: array vs. linked list, blocking vs. non-blocking, and memory overhead.

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