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
Climbing the Leaderboard
Sort by
recency
|
2375 Discussions
|
Please Login in order to post a comment
I believe this is the most optimized way to do it. Maybe we can remove the sort parts but it is still efficient. The key point is: the parameters are already sorted. Basically, it is possible to iterate through player list and keep the last compared index to not iterate all ranked array repeatedly.
(solution in Javascript(TS))i tracked where the last index was when the rank was updated and started the next loop from that index :
also i think the logic for comparing if the player's top rank [at last index] is bigger than ranked's higest could use some work, i would really love some suggestions for this .
A longer C++ solution:
Here is problem solution in Python, Java, C++, C and Javascript - https://programmingoneonone.com/hackerrank-climbing-the-leaderboard-problem-solution.html
Climbing the leaderboard in anything takes passion, consistency, and a bit of strategy — and finding the Best Apartment Communities is no different. Whether you’re new in town or just looking for an upgrade, it feels like a game where every move counts. From location and amenities to that perfect floor plan, every little detail adds up. It’s kind of exciting to tour places and see where you’ll rank them on your own list. I’ve definitely had those this is it moments walking into a new space. The Best Apartment Communities make it easy to feel at home while still feeling like you're winning. Have you checked out any recently that you’d rate a 10/10?