Problem · Design

Task Management System

EasyCircleFULLTIMEOA

Complete the function below. The function receives the full standard input as a single string and must return the exact standard output lines for the described problem.

Problem: Task Management System (Level 1)

Implement a simple task management system that supports adding tasks and retrieving the list of current tasks.

Commands

  • ADD_TASK <taskId> "<taskName>" <startTime> <endTime> — Creates a task with the given integer taskId, string taskName (always enclosed in double quotes in the input, even if it contains no spaces), integer startTime, and integer endTime, and stores it in the system. If a task with the same taskId already exists, the command is ignored (no update, no error).
  • GET_TASKS — Prints all tasks currently stored in the system, one per line, in the order they were successfully added (insertion order). If no tasks have been added, this command produces no output lines.

Output Format for GET_TASKS

Each task is printed on its own line in exactly the following format:

Task(id=<taskId>,name=<taskName>,start=<startTime>,end=<endTime>)

where taskName is printed without surrounding quotes.

Task Model

Each task contains:

  • taskId: unique integer identifier
  • taskName: string (may contain spaces or special characters)
  • startTime: non-negative integer
  • endTime: non-negative integer, greater than or equal to startTime

Level 1 does not require conflict or overlap validation.

Function Description

Complete solveTaskManagementSystem. It has one parameter, String input, containing the full stdin payload. Return the stdout payload as an array of lines, without trailing newline characters.

Examples
01 · Example 1
input = "ADD_TASK 1 \"Email\" 0 5\nGET_TASKS"
return = ["Task(id=1,name=Email,start=0,end=5)"]
The input contains the command ADD_TASK 1 "Email" 0 5 followed by GET_TASKS. The task name in the input is enclosed in double quotes. GET_TASKS prints one line per stored task in insertion order using the format Task(id=<taskId>,name=<taskName>,start=<startTime>,end=<endTime>), with the name printed without quotes. Since one task was added, the output is a single line: Task(id=1,name=Email,start=0,end=5).
Constraints

  • Number of commands: up to 104.
  • Number of tasks (successful ADD_TASK calls): up to 104.
  • taskId: integer in the range [1, 109].
  • startTime, endTime: non-negative integers with 0 ≤ startTime ≤ endTime ≤ 109.
  • taskName: a non-empty string enclosed in double quotes in the input; the name itself does not contain double-quote characters.
  • Duplicate taskId in ADD_TASK: the command is silently ignored; the existing task is not modified.
  • GET_TASKS with no stored tasks produces zero output lines.
  • Tasks in GET_TASKS output are listed in insertion order (the order of successful ADD_TASK commands).
  • Multiple GET_TASKS commands may appear; each prints the full current task list at the time of that command.

More Circle problems
drafts saved locally
public String[] solveTaskManagementSystem(String input) {
    // write your code here
}
input"ADD_TASK 1 \"Email\" 0 5\nGET_TASKS"
expected["Task(id=1", "name=Email", "start=0", "end=5)"]
sign in to submit