Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jackhowa/where-i-belong
Not the Linkin Park song, an algorithm and array problem. Return the lowest index at which a value (second argument) should be inserted into an array (first argument) once it has been sorted.
https://github.com/jackhowa/where-i-belong
algorithm freecodecamp
Last synced: 21 days ago
JSON representation
Not the Linkin Park song, an algorithm and array problem. Return the lowest index at which a value (second argument) should be inserted into an array (first argument) once it has been sorted.
- Host: GitHub
- URL: https://github.com/jackhowa/where-i-belong
- Owner: JackHowa
- Created: 2017-08-13T19:49:35.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-08-13T20:36:35.000Z (over 7 years ago)
- Last Synced: 2024-11-20T21:58:11.369Z (3 months ago)
- Topics: algorithm, freecodecamp
- Language: JavaScript
- Homepage: https://www.freecodecamp.org/challenges/where-do-i-belong
- Size: 2.93 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# where-i-belong
Return the lowest index at which a value (second argument) should be inserted into an array (first argument) once it has been sorted. The returned value should be a number.
For example, getIndexToIns([1,2,3,4], 1.5) should return 1 because it is greater than 1 (index 0), but less than 2 (index 1).
Likewise, getIndexToIns([20,3,5], 19) should return 2 because once the array has been sorted it will look like [3,5,20] and 19 is less than 20 (index 2) and greater than 5 (index 1).