Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
It's like a buoy
it's what I was thinking, basically are 2 nested loops, idiomatically is great but not forp performance.
thehappystone, yes, I agree. Rather than using some default like Number.Max_Value, or I saw someone using Infinity, since we've sorted the intervals, we could set the min value to sortedIntervals[0][0] and the max value to sortedIntervals[0][1], then just work off those numbers.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Just to make sure that any initial value you compare it to will be greater than that, since the interval numbers can be positive or negative. So we can't declare it with 0.
This comment is hidden because it contains spoiler information about the solution
Time complexity by using slice and reduce instead of traditional for loop is quite costly i guess
Yeah, it cost a lot of time. I try to use JSBench.me and your solution so much faster than this one.