Coinbase logo

Coinbase Interview Questions

52 practice questions for Coinbase technical interviews

Coinbase software engineer interviews cover algorithms, data structures, system design, and coding problems drawn from real interview rounds.

Software Engineer Backend Engineer Frontend Engineer Full Stack Engineer Mobile Engineer Data Engineer Data Scientist ML Engineer DevOps Engineer DevOps Engineer Product Manager SRE Security Engineer Engineering Manager Data Analyst UX/UI Designer QA Engineer
coding Medium Verified Question #1

1. Generate NFT


Category: String coding problem

Question You are designing an NFT generation engine. You are given a set of Traits, where each trait has a name and a list of possible...

Input: List
Output: Array
coding Medium Verified Question #2

2. Blockchain Mining


Category: Dynamic programming coding problem

Question You are building a block construction module for a blockchain node. The goal is to select a subset of pending transactions to include in...

Input: Graph (nodes and edges)
Output: Computed result
coding Medium Verified Question #3

3. Crypto Trading System Stream


Category: String coding problem

Question Design a crypto trading system that manages a stream of orders. The system should support various operations like placing, pausing,...

Input: Array of strings
Output: Computed result
coding Hard Verified Question #4

4. Design Iterators


Category: Array coding problem

Question For this problem, you will be designing a series of different iterator classes. This problem is split into multiple related parts that...

Input: Array of integers
Output: Computed result
coding Medium Verified Question #5

5. Food Delivery System


Category: Trie-based coding problem

Question For this problem, you will be designing a food delivery system. This problem is split into three related parts, evolving from basic data...

Input: List
Output: Computed result
coding Hard Verified Question #6

6. Transaction System


Category: Tree coding problem
For this problem, you will be designing a system to handle financial transactions and account balances. This problem is split into three related...
Input: List
Output: Integer
coding Hard Verified Question #7

7. OA[CodeSignal] Cloud File Storage System


Category: Graph coding problem

Question Your task is to implement a simple in-memory cloud storage system that maps objects (files) to their metadata (name, size, etc.). You...

Input: Graph (nodes and edges)
Output: Array
coding Hard Verified Question #8

8. OA[CodeSignal] Design Banking System


Category: Graph coding problem

Question Design a banking system that supports account management, transactions, and various financial operations.

Input: Graph (nodes and edges)
Output: Computed result
coding Hard Verified Question #9

9. Capital Gains Tax Calculator


Category: String coding problem
You are given a chronologically sorted list of stock transactions. Each transaction is a list of strings in the format `[<timestamp>, <type>,...
Input: Array of strings
Output: Computed result
coding Medium Verified Question #10

10. Service Log Aggregator


Category: Trie-based coding problem
A distributed system emits log entries from multiple services and worker threads. Each log entry is a colon-separated string in the format...
Input: Array
Output: Computed result
coding Hard Verified Question #11

11. OA [CodeSignal] Knowledge Base System


Category: Graph coding problem
Design and implement a personal knowledge base called KnowledgeBaseSystem that stores articles with CRUD operations. The system operates entirely...
Input: Graph (nodes and edges)
Output: Computed result
coding Medium Verified Question #12

12. OA [CodeSignal] Workspace Tracker


Category: Interval-based coding problem
Build a system to track desk workers at a shared office space. The system records when each worker enters and leaves and computes how long they have...
Input: String
Output: Array
coding Hard Verified Question #13

13. Transaction Query Engine


Category: String coding problem
Design a system to filter and paginate a list of transaction records. Each record is a list of strings in the format `[timestamp, id, userId,...
Input: Array of strings
Output: Computed result
coding Medium Verified Question #14

14. Exchange Rate Finder


Category: String coding problem
You are given a set of currency exchange relationships. Each relationship specifies a direct exchange rate between two currencies. Rates are...
Input: List
Output: Computed result
coding Hard Verified Question #15

15. Order Matching Engine


Category: String coding problem
You are managing a cryptocurrency order book. The book holds buy and sell orders placed by traders. - A buy order indicates the maximum price a...
Input: String
Output: Computed result
coding Hard Verified Question #16

16. Account Transfer System


Category: String coding problem
You are given a list of fund transfer instructions and a set of accounts with initial balances. Each transfer moves a fixed percentage of the...
Input: List
Output: Computed result
coding Hard Verified Question #17

17. Restaurant Delivery Network


Category: String coding problem
You are building a food discovery platform. Given a user's location, a list of restaurants with their coordinates, and a menu of items with prices,...
Input: List
Output: Computed result
coding Medium graph #1

1. Graph — Find the shortest path in a cryptocurrency transaction network


Background: In the world of cryptocurrency, understanding the quickest way to transfer assets across different wallets is critical for maintaining low transaction fees and efficient trading. This problem relates to optimizing transfers in Coinbase's wallet services.
Problem statement: Given a directed graph where nodes represent wallets and edges represent direct transactions between them, you need to find the shortest path (in terms of transaction hops) from a starting wallet startNode to a destination wallet endNode. Each edge is equivalent to a transaction that can either be successful or failed. If no such path exists, return None.
Function/class signature:
  • def shortest_path(graph: Dict[str, List[str]], startNode: str, endNode: str) -> Optional[List[str]]:


Example 1:
Input:
graph = { 'A': ['B', 'C'], 'B': ['D'], 'C': ['D'], 'D': [] }
startNode = 'A'
endNode = 'D'
Output:
['A', 'B', 'D']
Explanation: The shortest path from A to D is through B.
Example 2:
Input:
graph = { 'A': ['B', 'C'], 'B': [], 'C': ['D'], 'D': [] }
startNode = 'A'
endNode = 'D'
Output:
None
Explanation: There is no path from A to D.
Constraints:
  • Node names are alphanumeric strings with max length 50.

  • Graph can have up to 10^5 nodes.

  • Transactions (edges) can be up to 2 * 10^5 in the worst case.
coding Medium filtering #2

2. Coding — Implement a transaction filtering system


Background: As a cryptocurrency exchange, Coinbase needs to efficiently manage and filter transaction data to ensure compliance and enhance user security. This system should enable the detection of suspicious transactions and provide insights for further investigation.
Problem statement: You are tasked with building a TransactionFilter class that filters a list of transactions based on specific criteria. Each transaction is represented as a dictionary containing amount, currency, timestamp, and status. The class should have a method filter_transactions(transactions: List[Dict[str, Union[str, float]]], min_amount: float, currency_filter: str) -> List[Dict[str, Union[str, float]]] that returns all transactions where the amount is greater than or equal to min_amount and matches the given currency_filter.
Function/class signature:
  • class TransactionFilter:

  • def filter_transactions(transactions: List[Dict[str, Union[str, float]]], min_amount: float, currency_filter: str) -> List[Dict[str, Union[str, float]]]:


Example 1:
  • Input: transactions = [{'amount': 100.0, 'currency': 'USD', 'timestamp': '2023-10-01', 'status': 'completed'}, {'amount': 50.5, 'currency': 'EUR', 'timestamp': '2023-10-02', 'status': 'pending'}, {'amount': 150.0, 'currency': 'USD', 'timestamp': '2023-10-03', 'status': 'completed'}], min_amount = 100.0, currency_filter = 'USD'

  • Output: [{'amount': 100.0, 'currency': 'USD', 'timestamp': '2023-10-01', 'status': 'completed'}, {'amount': 150.0, 'currency': 'USD', 'timestamp': '2023-10-03', 'status': 'completed'}]

  • Explanation: Both transactions exceed the min_amount of 100.0 and are in USD.


Example 2:
  • Input: transactions = [{'amount': 200.0, 'currency': 'USD', 'timestamp': '2023-09-01', 'status': 'completed'}, {'amount': 60.0, 'currency': 'EUR', 'timestamp': '2023-09-02', 'status': 'failed'}, {'amount': 150.0, 'currency': 'EUR', 'timestamp': '2023-09-03', 'status': 'completed'}], min_amount = 70.0, currency_filter = 'EUR'

  • Output: [{'amount': 150.0, 'currency': 'EUR', 'timestamp': '2023-09-03', 'status': 'completed'}]

  • Explanation: Only the last transaction meets the criteria of being greater than or equal to 70.0 and in EUR.


Constraints:
  • All amounts are positive floats,

  • Currency strings are limited to three uppercase letters,

  • List of transactions has at most 10^4 entries.
coding Medium dynamic programming #3

3. [Dynamic Programming] — Maximum Profit from Cryptocurrency Trading

Background: Coinbase seeks to optimize user trading strategies to enhance profit margins during market fluctuations. A well-structured algorithm can help calculate the best times to buy and sell currencies based on historical data.
Problem statement: Given an array of integers representing the prices of a cryptocurrency over a series of days, implement a function to determine the maximum profit that could be made by buying on one day and selling on another. You may only complete one transaction (i.e., buy one and sell one share of the cryptocurrency). The function should return 0 if no profit can be made.
Function Signature: def max_profit(prices: List[int]) -> int:
Example 1:
  • Input: [7, 1, 5, 3, 6, 4]

  • Output: 5

  • Explanation: Buy on day 2 (price = 1) and sell on day 5 (price = 6), profit = 6 - 1 = 5.


Example 2:
  • Input: [7, 6, 4, 3, 1]

  • Output: 0

  • Explanation: In this case, no transactions are done and the max profit = 0.


Constraints:
  • 1 <= prices.length <= 10^5

  • 0 <= prices[i] <= 10^4
coding Medium array #4

4. Find Duplicate Number — Efficient search for duplicates in an array

Background: In the context of cryptocurrency transactions, identifying duplicate transactions is crucial for maintaining the integrity of financial records. This problem relates to ensuring that no transaction is processed more than once on the Coinbase platform.
Problem statement: Given an array of n + 1 integers where each integer is in the range [1, n], write a function to find the duplicate number. You must solve it without modifying the array and using O(1) extra space. Your solution should have a time complexity better than O(n^2).
Function/class signature:
  • def find_duplicate(nums: List[int]) -> int:

Example 1:
Input: [3, 1, 3, 4, 2]
Output: 3
Explanation: The number 3 appears twice.
Example 2:
Input: [1, 2, 3, 4, 4]
Output: 4
Explanation: The number 4 appears twice.
Constraints:
  • 2 <= n <= 10^5

  • The integers in the array are in the range [1, n] and there is at least one duplicate.
coding Medium graph #5

5. Graph — Find the shortest path in a cryptocurrency transaction network


Background: Coinbase deals with numerous cryptocurrency transactions that form a network. Calculating the shortest path between two transactions can help optimize network routes for better performance and reduced costs.
Problem statement: Given a directed graph where each node represents a cryptocurrency transaction and each directed edge represents a possible transaction path with an associated cost, implement a function to find the shortest path from a starting transaction src to a destination transaction dest. The graph is given as an adjacency list, and each edge has a non-negative cost.
Function/class signature:
  • def shortest_path(graph: Dict[str, List[Tuple[str, int]]], src: str, dest: str) -> Tuple[List[str], int]:


Example 1:
Input:
graph = {"A": [("B", 1), ("C", 4)], "B": [("C", 2), ("D", 5)], "C": [("D", 1)], "D": []}
src = "A", dest = "D"
Output: (['A', 'B', 'C', 'D'], 4)
Explanation: The shortest path is A -> B -> C -> D with a total cost of 4.
Example 2:
Input:
graph = {"X": [("Y", 2)], "Y": [("Z", 3)], "Z": []}
src = "X", dest = "Z"
Output: (['X', 'Y', 'Z'], 5)
Explanation: The shortest path is X -> Y -> Z with a total cost of 5.
Constraints:
  • 1 <= len(graph) <= 1000

  • 0 <= cost <= 1000

  • All transaction identifiers are unique strings.
coding Medium two pointers #6

6. [Two Pointers] — Find Duplicate Number in an Array

Background: In a financial app like Coinbase, ensuring the integrity of user data is critical. Identifying duplicates efficiently within a user's transaction history can help prevent fraud and maintain accurate records.
Problem statement: Given an array of n + 1 integers where each integer is in the range [1, n], find the duplicate number. You must solve it without modifying the array and using O(1) extra space. The solution should be optimized to have a better time complexity than O(n^2).
Function/class signature:
  • def find_duplicate(nums: List[int]) -> int:

Example 1:
  • Input: [3, 1, 3, 4, 2]

  • Output: 3

  • Explanation: The number 3 is repeated in the array.

Example 2:
  • Input: [1, 3, 4, 2, 2]

  • Output: 2

  • Explanation: The number 2 is repeated in the array.

Constraints:
  • 1 <= n <= 10^5

  • The integer values are in the range [1, n] and there's guaranteed to be one duplicate.
coding Medium database #7

7. SQL Window Functions — Identify Flights with Layovers

Background: Coinbase needs to efficiently analyze flight data for potential integration with a cryptocurrency travel service. Understanding flight layovers can help users plan better travel routes using digital currencies.
Problem statement: Given a table flights with columns flight_id, departure_airport, arrival_airport, and departure_time, you are required to return the flight_ids that have more than one layover. A layover is defined as having multiple connections in the journey from the departure to the final arrival airport. You should calculate the number of layovers by comparing the departure and arrival times of consecutive flights.
Function/class signature:
  • def find_flights_with_layovers(flights: List[Tuple[int, str, str, str]]) -> List[int]:

Example 1:
Input: flights = [(1, 'A', 'B', '2023-01-02 08:00'), (2, 'B', 'C', '2023-01-02 10:00'), (3, 'C', 'D', '2023-01-02 12:00'), (4, 'A', 'D', '2023-01-02 09:00')]
Output:
[1]
Explanation: Flight 1 has two layovers via B and C to reach D.
Example 2:
Input:
flights = [(5, 'X', 'Y', '2023-01-03 07:00'), (6, 'Y', 'Z', '2023-01-03 09:00'), (7, 'Y', 'X', '2023-01-03 10:30')]
Output: []
Constraints:
  • 1 <= len(flights) <= 10^4

  • Each flight_id is unique.

  • Time format is guaranteed to be ‘YYYY-MM-DD HH:MM’.

  • departure_airport and arrival_airport are strings representing airport codes.

coding Senior sliding window #8

8. [OA] Sliding Window — track active crypto markets over time

In the ever-changing world of cryptocurrency, it's crucial for Coinbase to determine the number of distinct markets that remain active within any given time frame.
Problem statement: Given an array of timestamps when markets were opened and closed, and a d days window, compute the total number of distinct markets open during that window.
  • Function signature: def count_active_markets(timestamps: List[Tuple[int, int]], d: int) -> int: returns an integer count of active markets.


Example 1:
Input: timestamps = [(1, 5), (2, 3), (4, 6)], d = 3
Output: 2
Explanation: Markets 1 and 2 overlap in the window [1, 4].
Example 2:
Input: timestamps = [(1, 2), (3, 5), (7, 10)], d = 3
Output: 1
Explanation: Only one market is active at any time in the window 1 to 4.
Constraints:
  • 1 <= timestamps.length <= 1000

  • 1 <= d <= 10000

  • Timestamps are unique.
coding Senior graph #9

9. [OA] Graph Traversal — Find the shortest path for crypto transactions

In Coinbase's ecosystem, efficient transaction routing is crucial for timely processing. The goal is to determine the shortest path between users in a peer-to-peer transaction graph.
Problem statement: Given a directed graph representing users and their transactions as edges, write a function to find the shortest path from the source user to the destination user. Users can have multiple transactions but there is a constraint on transaction types that can be traversed.
  • Function signature: def shortest_path(transactions: List[Tuple[int, int]], source: int, destination: int) -> List[int]: returns a list of users representing the shortest path.


Example 1:
Input: transactions = [(1, 2), (2, 3), (2, 4), (3, 4)]
Output: [1, 2, 3]
Explanation: The path from user 1 to user 3 is through user 2.
Example 2:
Input: transactions = [(1, 2), (1, 3), (3, 4), (2, 4)]
Output: [1, 3, 4]
Explanation: The path from user 1 to user 4 is through user 3.
Constraints:
  • 1 <= transactions.length <= 100

  • 1 <= source, destination <= 10^4

  • All transactions are unique.
system design Senior api design #10

10. [OA] Twitter Feed — Design a user feed for Coinbase's social trading features

As Coinbase looks to integrate social features for trading, it's essential to design a system that tracks user feeds efficiently.
Problem statement: Design a class to manage a user's feed. Supports the following methods: follow(follower_id: int, followee_id: int), unfollow(follower_id: int, followee_id: int), and get_feed(user_id: int) -> List[int]. The feed should return the most recent 10 transactions from the followed users.
  • Method signatures:

- def follow(follower_id: int, followee_id: int) -> None: update the following relationship.
- def unfollow(follower_id: int, followee_id: int) -> None: remove the following relationship.
- def get_feed(user_id: int) -> List[int]: return the user feed containing transaction IDs of the most recent 10 transactions from followed users.
Example 1:
Input: manager = FeedManager()
manager.follow(1, 2)
manager.follow(1, 3)
manager.get_feed(1)
Output: [x, y, z]
Constraints:
  • 1 <= follower_id, followee_id <= 10^4

  • Transaction history size can be up to 10^5.
system design Senior caching #11

11. [OA] LRU Cache — Design a caching layer for Coinbase's API responses

In order to optimize data retrieval times and minimize database load, Coinbase requires an LRU cache to manage frequent API requests efficiently.
Problem statement: Design and implement a class that represents an LRU Cache with a fixed capacity. Supports get(key: int) -> int and put(key: int, value: int) -> void methods.
  • Method signatures:

- def get(key: int) -> int: returns the value of the key if it exists or -1.
- def put(key: int, value: int) -> None: updates the value if the key exists, otherwise, adds the key-value pair to the cache. If the cache reaches its capacity, it should invalidate the least recently used item before inserting a new item.
Example 1:
Input: cache = LRUCache(2)
cache.put(1, 1)
cache.put(2, 2)
cache.get(1)
Output: 1
cache.put(3, 3)
cache.get(2)
Output: -1
Constraints:
  • 1 <= capacity <= 3000

  • 0 <= key, value <= 10^4.

Start practicing Coinbase questions

Sign up for free to access walkthroughs, AI-generated questions, and more.

Get Started Free