Coinbase data scientist interviews test statistical reasoning, ML model design, SQL proficiency, A/B testing methodology, and Python-based algorithm implementation.
KnowledgeBaseSystem that stores articles with CRUD operations. The system operates entirely...Input: Graph (nodes and edges)ModelVersionRegistry class that provides functionalities to register new models, retrieve information about a specific model by version, and get the latest model version. The registry should support the following methods:register_model(model_name: str, version: str, metadata: dict): Registers a model with a specific version and metadata.get_model_by_version(model_name: str, version: str): Retrieves the model data for the given model name and version.get_latest_model(model_name: str): Gets the latest version of the registered model.Example 1:ModelVersionRegistry()registry.get_latest_model('risk_model') returns {'version': '1.1', 'metadata': {'accuracy': 0.97}}Constraints:UserActivityTracker capable of adding and retrieving user transaction counts over time. The class should provide the following functionalities:add_transaction(user_id: int): Adds a transaction for the specified user.get_transaction_count(user_id: int) -> int: Returns the total number of transactions for the specified user.get_total_transactions() -> int: Returns the total transaction count across all users.Example 1:UserActivityTracker()tracker.get_transaction_count(1) returns 2tracker.get_total_transactions() returns 3Constraints:1 and 10^4.10^5.(user_id, product_id), write a function to return the number of distinct products that each user has interacted with.- Method Signature: def count_distinct_products(transactions: List[Tuple[int, int]]) -> Dict[int, int]: Returns a dictionary with user_id as keys and the count of distinct product_ids as values.Example 1:transactions = [(1, 101), (1, 102), (2, 101), (1, 101), (2, 103)]{1: 2, 2: 2}1 <= len(transactions) <= 10^51 <= user_id, product_id <= 10^4n transaction amounts within the transaction history array. You need to capture the transaction amounts over a window_size.- Method Signature: def max_subarray_sum(transactions: List[int], window_size: int) -> int: Returns the maximum sum of a contiguous subarray of the specified size.Example 1:transactions = [1, -2, 3, 4, -1, 2, 1, -5, 4], window_size = 36[3, 4, -1] has the maximum sum of 6.Constraints:1 <= len(transactions) <= 10^5-10^4 <= transactions[i] <= 10^41 <= window_size <= len(transactions)Sign up for free to access walkthroughs, AI-generated questions, and more.
Get Started Free