← Akuna Capital Interview Insights

Akuna Capital·Software Engineer·Technical Phone Screen·Intermediate

IntermediatePrefer not to say
May 2026

Summary

Got a coding problem at Akuna Capital for a Software Engineer role that was basically about designing a two-user communication channel with proper state management and custom exceptions. Pretty classic OOP design question but with enough edge cases to trip you up if you're not careful.

Questions Asked (1)

Q1

Design and implement a communications handler that manages a one-at-a-time conversation channel between exactly two distinct users. You need a custom exception type, an abstract base class with connect, hangup, and clear_all methods, and a concrete implementation that enforces all the stated constraints.

System DesignAlgorithms & Data StructuresAPI & Integrations
Author's notes

The abstract base class part was fine, I've done that kind of thing before.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the requirements and constraints, such as whether the channel is persistent or ephemeral, and how to handle concurrent connection attempts. Then, design the class hierarchy with an abstract base class defining the interface and a concrete implementation that enforces the one-at-a-time conversation between exactly two users. Finally, discuss how you would test the implementation, including edge cases like attempting to connect a third user or disconnecting a non-participant.

Pro tip: Emphasize thread safety and error handling: use synchronization to prevent race conditions when multiple users try to connect simultaneously, and define a custom exception with clear, actionable messages to simplify debugging and client error handling.

1. Clarify Requirements and Constraints

Ask questions to understand the expected behavior: Is the channel persistent? Can users reconnect? What happens if a third user tries to connect? Should the handler support multiple independent channels?

2. Design the Class Hierarchy

Define an abstract base class with pure virtual methods connect, hangup, and clear_all. Create a custom exception class (e.g., CommunicationException) that derives from std::exception or a similar base, with informative error messages.

3. Implement the Concrete Handler

Implement the concrete class with state to track the two participants. Use a mutex or other synchronization to ensure thread safety. Enforce constraints: only two distinct users, one conversation at a time, and proper cleanup on hangup or clear_all.

4. Handle Edge Cases and Errors

Throw the custom exception for invalid operations, such as connecting a third user, connecting an already connected user, hanging up a non-participant, or calling connect when the channel is full. Ensure clear_all resets the state and disconnects both users.

5. Test and Validate

Outline unit tests covering normal flow, concurrent connection attempts, and error conditions. Discuss how to verify thread safety and exception handling.

Key Points to Mention

  • Abstract base class with virtual destructor and pure virtual methods for interface consistency.
  • Custom exception class inheriting from std::exception, with a descriptive what() message.
  • Thread safety using mutexes or locks to prevent race conditions in connect and hangup.
  • State management: tracking the two participants and ensuring they are distinct.
  • Enforcement of one-at-a-time conversation: rejecting additional connections until the current one ends.
  • Proper resource cleanup in hangup and clear_all, including resetting state and releasing locks.

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