I'm still learning, but I assume this would be more expensive since we're creating a copy of the array using the spread syntax, right? Using the every method, would be O(n) at worst. While if we use this spread syntax itself would already be O(n) on top of another O(n) from the Math.max
Doh! Why didn't I think of that!
and I thought mine was clever..
I'm still learning, but I assume this would be more expensive since we're creating a copy of the array using the spread syntax, right? Using the every method, would be O(n) at worst. While if we use this spread syntax itself would already be O(n) on top of another O(n) from the Math.max
Love this one!
This seems quciker then what i wrote lol
Such a cool!
Thank you. I just needed fresh head to understand it
This comment is hidden because it contains spoiler information about the solution
Not best practice:
No need to iterate through the whole array
No need to calculate the max
Can return on the first number greater than the limit
wow one line that's much easier
I thought I wrote it cool. It's even cooler here. )
clever yeah
But clever! :] It is a fresh idea.
Not best practice: Consider an array with
limit+1
as the first element followed by 1000000limit-1
.