Todo Task Manager Operations
Updated
Problem statement
Process a finite ordered sequence of todo-task operations. Each task has a unique integer ID, a title, and one status: new, pending, or resolved.
["CREATE", id, title]creates a task with statusnewand returnsOK, orEXISTSif the ID is already present.["READ", id]returnsid|title|status, orNOT_FOUND.["UPDATE_TITLE", id, title]and["UPDATE_STATUS", id, status]returnOKon success orNOT_FOUND. An invalid status returnsINVALID_STATUSwithout changing the task.["DELETE", id]removes the task and returnsOK, orNOT_FOUND.
Return one result for every operation in input order.
Function
manageTasks(operations: String[][]) → String[]Examples
Example 1
operations = [["CREATE","7","Ship release"],["READ","7"],["UPDATE_STATUS","7","pending"],["READ","7"],["DELETE","7"],["READ","7"]]return = ["OK","7|Ship release|new","OK","7|Ship release|pending","OK","NOT_FOUND"]The task is created, updated, read in both states, deleted, and then no longer exists.
Example 2
operations = [["CREATE","1","Draft"],["CREATE","1","Again"],["UPDATE_STATUS","1","closed"],["READ","1"]]return = ["OK","EXISTS","INVALID_STATUS","1|Draft|new"]A duplicate create and an invalid status leave the existing task unchanged.
Constraints
1 <= operations.length <= 10^5.- Task IDs are non-negative 32-bit integers encoded as decimal strings.
- Titles are non-empty and do not contain
|. - Every operation has the exact arity described above.
More Cisco interview questions
- Find the Duplicate Number Without Modifying the ArrayONSITE INTERVIEW · Seen Sep 2026
- Check if a String Is a PalindromePHONE SCREEN · Seen Nov 2026
- Find Unique ElementsPHONE SCREEN · Seen Nov 2026
- First Letter to Appear TwicePHONE SCREEN · Seen Nov 2026
- Middle of a Linked ListPHONE SCREEN · Seen Nov 2026
- Reverse a Linked ListPHONE SCREEN · Seen Nov 2026
- Reverse a StringPHONE SCREEN · Seen Nov 2026
- Valid ParenthesesPHONE SCREEN · Seen Nov 2026
- K-Step Bit Flip with RetentionPHONE SCREEN · Seen Nov 2026
- Longest Non-Repeating SubstringPHONE SCREEN · Seen Jul 2026
Similar questions at other companies
- Random Dasher Set OperationsDoorDash · ONSITE INTERVIEWDoorDash interview questions
- LRU Cache for Query ResultsAmazon · PHONE SCREEN · ONSITE INTERVIEW
- In-Memory Filesystem CommandsPerplexity AI · PHONE SCREEN · ONSITE INTERVIEWPerplexity AI interview questions
- Rectangle Point Coverage CountsOpenAI · PHONE SCREEN · ONSITE INTERVIEWOpenAI interview questions
- In-Memory Vault File SystemHarvey · ONSITE INTERVIEWHarvey interview questions
- Hash Map with Separate ChainingApplied Intuition · ONSITE INTERVIEWApplied Intuition interview questions
- Camel CardsRippling · PHONE SCREEN · ONSITE INTERVIEWRippling interview questions
- Design Authentication ManagerOracle · ONSITE INTERVIEWOracle interview questions
- Hash Map with TTLNike, Inc. · ONSITE INTERVIEWNike, Inc. interview questions
- Least Recently Used CacheMicrosoft · OA · PHONE SCREEN · ONSITE INTERVIEWMicrosoft interview questions