| Folder Name | Branch | Score | Coefficient |
|---|---|---|---|
| /autocomplete | autocomplete | 100 | 0.3 |
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.
const data = [
'java',
'javascript',
'python',
];
const autocomplete = createAutoComplete(data);
autocomplete('ja'); // returns [ 'java', 'javascript' ]
autocomplete('javas'); // returns [ 'javascript' ]
autocomplete('p'); // returns [ 'python' ]
index.js file in the autocomplete folder must export the createAutoComplete function as follows:function createAutoComplete(data) {}
module.exports = { createAutoComplete };
Your Pull Request must include:
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 |