Awesome!

!

Thank you.

OP solved it, closing

I've done the same haha! Completely forgot I can do it recursively! Good job :)

This is the best practice solution I have seen so far.

There are a couple of excellent ideas in here. Bad for production though. Nice one! Voted Clever.

same idea as you

It is n(log n) for the sorting and 2n because we traverse the resulting array 2 more times. Where n is the length of the array. So if we remove the not important factors it is n(log n).

Awesome!

!

!

!

Thank you.

OP solved it, closing

!

!

!

!

I've done the same haha! Completely forgot I can do it recursively! Good job :)

This is the best practice solution I have seen so far.

There are a couple of excellent ideas in here. Bad for production though. Nice one! Voted Clever.

same idea as you

It is n(log n) for the sorting and 2n because we traverse the resulting array 2 more times. Where n is the length of the array. So if we remove the not important factors it is n(log n).

## Loading more items...