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
|
2353 Discussions
|
Please Login in order to post a comment
My Python code is unable to complete four testcases because it can't complete the task within the time limit. Can anyone hlep me optimize my code?
Time complexity: O(n*log(n))
Space complexity: O(n)
Idea:
std::vector climbingLeaderboard(std::vector rk, std::vector p) { std::vector uu; for (size_t i = 0; i < rk.size(); i++) { if (i == 0 || rk[i] != rk[i - 1]) { uu.push_back(rk[i]); } } std::vector rst(p.size()); int ri = uu.size() - 1; for (size_t i = 0; i < p.size(); i++) {
}
var poistion_array = []
var poistion_dic = {}
var poistion = 1 for (var i = 0; i < ranked.length ; i++){
}
var previous_index = ranked.length - 1 for (var i = 0; i < player.length; i++){
} console.log(poistion_array) return poistion_array }