#419Classify the sequence taskEasy

Classify the sequence task

Background

Sequence problems are categorised by how many elements go in and come out:

input lengthoutput lengthcategory
11one-to-one
> 11many-to-one (e.g. sentiment)
1> 1one-to-many (e.g. captioning)
> 1> 1many-to-many (e.g. translation)

Problem statement

Implement task_category(input_len, output_len) returning the category string.

Input

  • input_lenint 1\ge 1.
  • output_lenint 1\ge 1.

Output

Returns one of "one-to-one", "many-to-one", "one-to-many", "many-to-many".

Examples

Example 1 — sentiment classification

Input:  input_len = 5, output_len = 1
Output: "many-to-one"

Example 2 — translation

Input:  input_len = 5, output_len = 7
Output: "many-to-many"

Constraints

  • "many" means length > 1; "one" means length == 1.
  • Return the exact category string.

Notes

  • The category tells you the architecture shape: where the network reads inputs and where it must emit outputs.
Python
Loading...

▶ Run executes the 3 visible sample tests below in your browser. Submit runs the full suite — including hidden tests — on the server for an official verdict.

  • Reference many to one
  • Sample one to many
  • Example many to many