← AkunaCapital Interview Insights

AkunaCapital·Software Engineer·Technical Phone Screen·Intermediate

IntermediatePrefer not to say
Jul 2026

Summary

Coding round at Akuna Capital for a software engineering role. The problem looked deceptively simple at first glance but the edge cases kept piling up as I got deeper into it.

Questions Asked (1)

Q1

Design and implement a communication connection manager: a custom exception class and a handler class that supports connecting two users, hanging up a connection, and clearing all connections. Each user can only be in one active connection at a time, and the handler must enforce this along with other constraints like self-connections.

System DesignAlgorithms & Data StructuresTechnical Trade-offs
Author's notes

The hash map approach came to me pretty fast, user maps to their current partner, bidirectional.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements and constraints, then design the exception class and handler with appropriate data structures. Implement the methods with careful validation and discuss trade-offs like thread safety and error handling.

Pro tip: Demonstrate maturity by proactively discussing thread safety and concurrency, as real-world systems often require handling multiple simultaneous connections.

1. Clarify Requirements and Constraints

Ask questions to confirm edge cases: self-connection, duplicate connections, hanging up non-existent connections, and clearing when no connections exist. Also clarify if thread safety is required.

2. Design the Exception Class

Create a custom exception class (e.g., ConnectionException) that extends Exception or RuntimeException, with constructors for message and cause. Consider including error codes for different failure scenarios.

3. Design the Handler Class

Choose data structures: a map from user to connected user (e.g., HashMap<User, User>) to track active connections. Ensure O(1) operations for connect, hangup, and clear.

4. Implement Core Methods

Implement connect(user1, user2): validate users are not the same, neither is already connected, then add to map. Implement hangup(user): remove both users from map. Implement clearAll(): clear the map.

5. Discuss Trade-offs and Extensions

Mention thread safety (use ConcurrentHashMap or synchronization), error handling strategies, and potential extensions like connection history or timeouts.

Key Points to Mention

  • Custom exception class with meaningful error messages and possibly error codes.
  • Data structure choice: HashMap for O(1) average time complexity for connect, hangup, and clear.
  • Validation: self-connection, user already connected, user not connected when hanging up.
  • Thread safety considerations: synchronized methods or ConcurrentHashMap for concurrent access.
  • Edge cases: null users, clearing when no connections, hanging up a user not in any connection.
  • Trade-offs: memory usage vs. speed, simplicity vs. extensibility.

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