HubSpot software engineer interviews cover algorithms, data structures, system design, and coding problems drawn from real interview rounds.
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)Question Design a banking system that supports account management, transactions, and various financial operations.
Input: Graph (nodes and edges)Description Implement a simplified in-memory database that supports record manipulation with various operations. The system should handle basic...
Input: Graph (nodes and edges)s and a positive...Input: Graph (nodes and edges)Question A conference platform manages associations between events, attendees, and their roles. Each association is represented by three strings:...
Input: ListQuestion A remote-work platform needs to schedule weekly standups for distributed teams. Each team member provides a list of dates (formatted as...
Input: ListQuestion A streaming analytics platform needs to track peak viewership for each user on each day. You are given a list of Session records. Each...
text containing only lowercase English letters and a positive integer k, find the substring of length k that appears most...Input: Graph (nodes and edges)LRUCache which supports get and put operations. The get method should retrieve a value from the cache if it exists, marking it as recently used. The put method should insert a value into the cache; if the cache exceeds its capacity, it should evict the least recently used item. The capacity of the cache will be provided upon initialization.class LRUCache:def __init__(self, capacity: int) -> None: # Initialize the LRUCache with positive size capacity.def get(self, key: int) -> int: # Return the value of the key if the key exists, otherwise return -1.def put(self, key: int, value: int) -> None: # Update the value of the key if the key exists. Otherwise, add the key-value pair to the cache. If the number of keys exceeds the capacity, evict the least recently used key.cache = LRUCache(2)cache.put(1, 1)cache.put(2, 2)cache.get(1) → Output: 1 (The cache is now {1=1, 2=2})1 is retrieved successfully, confirming it is in cache.cache.put(3, 3)cache.get(2) → Output: -1 (The cache is now {1=1, 3=3})3 evicts 2 which is the least recently used item.1 <= capacity <= 30000 <= key <= 100000 <= value <= 10000get and put will be called at most 10^4 times.def add_task(self, task_id: int, name: str) -> None:def mark_complete(self, task_id: int) -> None:def get_active_tasks(self) -> List[str]:add_task(1, "Design UI")Noneadd_task(2, "Develop Backend")Noneget_active_tasks()['Design UI', 'Develop Backend']mark_complete(1)Noneget_active_tasks()['Develop Backend']add_task(3, "Testing")Noneadd_task(4, "Deployment")Nonemark_complete(3)Noneget_active_tasks()['Deployment']id, title, description, status, and a timestamp for creation. create_task(title: str, description: str) -> int update_task(task_id: int, title: Optional[str] = None, description: Optional[str] = None, status: Optional[str] = None) -> bool delete_task(task_id: int) -> bool get_task(task_id: int) -> Optional[Dict[str, Any]] create_task("Fix bug", "Address issue #123") 1 1. update_task(1, status="completed") True 1 is updated to completed. title, description, and a completed state. Implement the following methods:add_task(title: str, description: str) -> Nonecomplete_task(title: str) -> Noneget_pending_tasks() -> List[Dict[str, Union[str, bool]]]add_task(title: str, description: str) -> Nonecomplete_task(title: str) -> Noneget_pending_tasks() -> List[Dict[str, Union[str, bool]]]add_task("Task 1", "Description for Task 1") None get_pending_tasks() [{'title': 'Task 1', 'description': 'Description for Task 1', 'completed': False}]Example 2: add_task("Task 2", "Description for Task 2") None complete_task("Task 2") None get_pending_tasks() [{'title': 'Task 1', 'description': 'Description for Task 1', 'completed': False}]Constraints:TaskManager, that can manage tasks for a project. The tasks should include methods to add tasks, mark them as completed, retrieve all tasks, and filter completed and active tasks.def add_task(self, task_id: int, task_description: str) -> None:def mark_completed(self, task_id: int) -> None:def get_all_tasks(self) -> List[Dict[str, Union[int, str, bool]]]:def get_completed_tasks(self) -> List[Dict[str, Union[int, str, bool]]]:task_manager.add_task(1, "Write proposal")Nonetask_manager.mark_completed(1)NoneTaskManager that allows you to track all tasks and their states. Each task can be either Open, In Progress, or Completed. The class should provide functionalities to add new tasks, update their states, and retrieve the percentage of tasks that have been completed. Task IDs should be unique integers, and you must manage these in a list internally.def __init__(self): -> Nonedef add_task(self, task_id: int, task_name: str) -> None:def update_task(self, task_id: int, status: str) -> None:def get_completion_percentage(self) -> float:tm.add_task(1, "Write Blog Post") None tm.add_task(2, "Develop Feature") None Input: tm.update_task(1, "In Progress") None Input: tm.update_task(2, "Completed") None Input: tm.get_completion_percentage() 50.0 tm.add_task(3, "Review Code") None Input: tm.update_task(3, "Completed") None Input: tm.get_completion_percentage() 66.67 TaskManager that allows users to manage tasks. Each task should have an ID, title, description, and a status. The TaskManager should allow adding, removing, and updating tasks, as well as retrieving all tasks in a specified status.def add_task(title: str, description: str) -> int: def remove_task(task_id: int) -> bool: def update_task(task_id: int, title: Optional[str] = None, description: Optional[str] = None, status: Optional[str] = None) -> bool: def get_tasks_by_status(status: str) -> List[Dict[str, Union[int, str]]]: Example 1: tm = TaskManager() tm.add_task("Write documentation", "Create user guides and API docs") 1 1.Example 2: tm.update_task(1, status="completed") True 1 is successfully updated to completed.Constraints: 1. ['pending', 'in_progress', 'completed']. 1000. Sign up for free to access walkthroughs, AI-generated questions, and more.
Get Started Free