Apply new format to snippets and template
This commit is contained in:
@ -5,8 +5,8 @@ tags: array,math,intermediate
|
||||
|
||||
Returns the lowest index at which value should be inserted into array in order to maintain its sort order.
|
||||
|
||||
Check if the array is sorted in descending order (loosely).
|
||||
Use `Array.prototype.findIndex()` to find the appropriate index where the element should be inserted.
|
||||
- Check if the array is sorted in descending order (loosely).
|
||||
- Use `Array.prototype.findIndex()` to find the appropriate index where the element should be inserted.
|
||||
|
||||
```js
|
||||
const sortedIndex = (arr, n) => {
|
||||
@ -19,4 +19,4 @@ const sortedIndex = (arr, n) => {
|
||||
```js
|
||||
sortedIndex([5, 3, 2, 1], 4); // 1
|
||||
sortedIndex([30, 50], 40); // 1
|
||||
```
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user