August 2024
Intermediate to advanced
516 pages
11h 47m
English
The following exercises provide you with the opportunity to practice with algorithms in practical situations. The solutions to these exercises are found in the section Chapter 7.
Use Big O notation to describe the time complexity of the following function. The function returns true if the array is a 100-sum array, and false if it is not.
A 100-sum array meets the following criteria:
Here’s the function:
| | function oneHundredSum(array) { |
| | if (array.length % 2 !== 0 || array.length === 0) { |
| | return false; |
| | } |
| | |
| | let leftIndex = 0; |
| | let rightIndex = array.length - ... |
Read now
Unlock full access