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
|
97 Discussions
|
Please Login in order to post a comment
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.
be careful with the time limit exceed, so annoying
the program should be sort desc (start from last)
This would be a terrible interview question and is wasting people's time. The problem should be clarified by HackerRank.
It expects output values that would arise if each player was ranked within continuous operation but handles input/output in batches. The pre-sorted player scores add to the confusion. The solver then needs to ignore available information (later player scores) and provide "wrong" or "stale" answers.
We cannot practice eliciting and solving for requirements if they are not presented in the question and there is no interviewer.