Level 1 Tasks with generated ids
Build TaskManager. Every method takes an integer timestamp first; timestamps strictly increase from call to call.
add_task(timestamp, name, priority) -> str: create a task and return its id. Ids are handed out by a counter: the first task is"task_id_1", the next"task_id_2", and so on. Names don't have to be unique.update_task(timestamp, task_id, name, priority) -> bool: replace the task's name and priority.Falseif there's no such task.get_task(timestamp, task_id) -> str | None: the task as a compact JSON string with the name first and no spaces, exactly like{"name":"deploy","priority":3}.Nonefor an unknown id.
tm = TaskManager()
tm.add_task(1, "deploy", 3) # "task_id_1"
tm.add_task(2, "deploy", 7) # "task_id_2"
tm.update_task(3, "task_id_1", "rollback", 9) # True
tm.get_task(4, "task_id_1") # '{"name":"rollback","priority":9}'
tm.update_task(5, "task_id_9", "x", 1) # False
Names contain no quotes or backslashes. Priorities are integers and can be negative. The id format and the JSON layout are compared as exact strings.