Back to problems

Design Task Manager

Object-Oriented Programming · Apple · Medium

Linear Scan (Brute Force) The most direct way to manage tasks is to store them in a simple list. Adding a task appends to the list in $$O(1)$$. Editing, removing, or executing the top task requires scanning the entire list to find the target task or the highest priority one. This leads to $$O(n)$$ time for those operations, where $$n$$ is the current number of tasks. Given that the total number of operations can be up to $$10^5$$, such a linear approach would be too slow for…

Checking your access…