epam-short-track

Task 2. Autocomplete

Folder Name Branch Score Coefficient
/autocomplete autocomplete 100 0.3

Task Description

Implement a custom createAutoComplete function that efficiently returns all strings from a given array that start with a provided prefix. You are expected to implement the fastest possible search algorithm, specifically using binary search. Your solution will be evaluated for both correctness and performance.

Requirements

Example

const data = [
  'java',
  'javascript',
  'python',
];

const autocomplete = createAutoComplete(data);

autocomplete('ja'); // returns [ 'java', 'javascript' ]
autocomplete('javas'); // returns [ 'javascript' ]
autocomplete('p'); // returns [ 'python' ]

Implementation Details

function createAutoComplete(data) {}

module.exports = { createAutoComplete };

Pull Request Requirements

Your Pull Request must include:


Mentor Checklist

Maximum Score: 100 points

Criteria Points
The branch is named autocomplete 5
Commit messages follow RS School Git Convention 5
The autocomplete folder exists 5
The index.js file exists in the correct folder 5
The index.js file exports the createAutoComplete function 5
The function is implemented using binary search 20
The function passes all provided tests 20
The solution is well-structured, readable, and follow best practices 10
   
Pull Request description includes all required elements:  
Task URL is included in the PR 5
Screenshot of local test results is attached in the PR 5
Algorithm analysis (Big O) is provided in the PR description 5
Submission and Deadline Dates are included in the PR 5
Your self-check of the task’s completion using checkboxes is included in the PR 5
   
Penalty: Commit after the deadline and before mentor review -20
Penalty: The solution includes any comments -50
Penalty: The solution includes console.log -10
Penalty: The PR includes more then one required index.js file -50

Notes