Skip to content
Luke edited this page Feb 14, 2019 · 3 revisions

The Problem

Given an arbitrary number of queries and pages, return a maximum 5 results

  • We have Classifications and Queries.

    • Each have an identifier and an array of key words.
  • Input will be in the form of a string.

    • Each line will be a different Query or Classification.
    • Queries are lines starting with Q
    • Classifications are lines starting with P
    • Elements on a line, including the code character, are delineated by one or more space characters.
    • Each line will have a list of 1-10 key words.
  • Output will also be in the form of a string.

    • For each Query return the pages that have a non zero score in decreasing order.
    • Each queries results will go on a separate line, in the form Qn: where n is the number of the query.
    • and page number of the form Qn where n is the number of the page.

Enhancements

Accuracy

  • Would be better to filter out any repeating elements in a given notation.

Extendability

  • Results (r) could be a variable that defaults to 5.
  • N could be the maximum length of either the query or page classification arrays.

Performance

  • Comparing the shorter string against the longer string to have less iterations.

Security

  • Add a filter out special characters
Clone this wiki locally