We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Climbing the Leaderboard
- Discussions
Climbing the Leaderboard
Climbing the Leaderboard
Sort by
recency
|
99 Discussions
|
Please Login in order to post a comment
java
I do not understand the solution for the example: The existing scores are [100,90,90,80], The new players are [70,80,105]. The combined score board should be [105,100,90,80,70], so that the return should be [5,4,1] instead of [4,3,1].
Problem with Javascript rendered this unsolvable
Simple work around to achieve O(n) time and space complexity taking advantage of the fact that the array is already sorted. Beats the other solutions since we do not have to sort the array again or run binary search n times. Same space complexity as we have to make a new array for the solution anyway.
Binary search would do and turns out it was pretty straight forward. Here is my snippet in Javascript.