Task Management System

Asked at AirbnbOnline assessment

Reported by the problem's creator, not verified

You are building an in-memory task management system as the class SimpleTaskManagementSystem. Every method takes the call's timestamp as its first argument.

Examples

  1. Example 1

    Input: init = [], operations = [["add_task",[1,"Task 1",5]],["add_task",[2,"Task 1",5]],["update_task",[3,"task_id_1","Updated Task 1",4]],["get_task",[4,"task_id_1"]],["get_task",[5,"task_id_2"]],["update_task",[6,"task_id_3","Missing",1]],["get_task",[7,"task_id_3"]],["update_task",[8,"task_id_2","Task 1",5]],["get_task",[9,"task_id_2"]]]

    Output: ["task_id_1","task_id_2",true,"{\"name\":\"Updated Task 1\",\"priority\":4}","{\"name\":\"Task 1\",\"priority\":5}",false,null,true,"{\"name\":\"Task 1\",\"priority\":5}"]

    Explanation: Both tasks are named Task 1 with priority 5 and get ids task_id_1 and task_id_2. Updating the first one changes only that task, and get_task returns it as compact JSON. task_id_3 does not exist, so updating or reading it gives false and null. Updating task_id_2 to the values it already has succeeds.

Import your own questions
Paste a question you were asked and get a full problem: statement, tests and a checked solution.
Import a question

Code

Loading editor…

Ln 1, Col 1

Start an attempt to use Coach.