Coinbase software engineer interviews cover algorithms, data structures, system design, and coding problems drawn from real interview rounds.
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: ListQuestion 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)Question Design a crypto trading system that manages a stream of orders. The system should support various operations like placing, pausing,...
Input: Array of stringsQuestion For this problem, you will be designing a food delivery system. This problem is split into three related parts, evolving from basic data...
Input: ListstartNode 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]]:graph = { 'A': ['B', 'C'], 'B': ['D'], 'C': ['D'], 'D': [] } startNode = 'A' endNode = 'D' ['A', 'B', 'D'] graph = { 'A': ['B', 'C'], 'B': [], 'C': ['D'], 'D': [] } startNode = 'A' endNode = 'D' None 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]]]: 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' [{'amount': 100.0, 'currency': 'USD', 'timestamp': '2023-10-01', 'status': 'completed'}, {'amount': 150.0, 'currency': 'USD', 'timestamp': '2023-10-03', 'status': 'completed'}] min_amount of 100.0 and are in USD. 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' [{'amount': 150.0, 'currency': 'EUR', 'timestamp': '2023-09-03', 'status': 'completed'}] EUR. def max_profit(prices: List[int]) -> int:[7, 1, 5, 3, 6, 4]5[7, 6, 4, 3, 1]01 <= prices.length <= 10^5 0 <= prices[i] <= 10^4n + 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).def find_duplicate(nums: List[int]) -> int:[3, 1, 3, 4, 2]33 appears twice.[1, 2, 3, 4, 4]44 appears twice.2 <= n <= 10^5[1, n] and there is at least one duplicate.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]:graph = {"A": [("B", 1), ("C", 4)], "B": [("C", 2), ("D", 5)], "C": [("D", 1)], "D": []} src = "A", dest = "D" graph = {"X": [("Y", 2)], "Y": [("Z", 3)], "Z": []} src = "X", dest = "Z" 1 <= len(graph) <= 1000 0 <= cost <= 1000 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).def find_duplicate(nums: List[int]) -> int:[3, 1, 3, 4, 2] 3 3 is repeated in the array.[1, 3, 4, 2, 2] 2 2 is repeated in the array.1 <= n <= 10^5 [1, n] and there's guaranteed to be one duplicate.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. def find_flights_with_layovers(flights: List[Tuple[int, str, str, str]]) -> List[int]: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')] [] departure_airport and arrival_airport are strings representing airport codes.Sign up for free to access walkthroughs, AI-generated questions, and more.
Get Started Free