You are viewing a single comment's thread. Return to all comments →
function climbingLeaderboard(ranked: number[], player: number[]): number[] { let uniqueRanks = Array.from(new Set(ranked)); let pos = 0; let ans = new Array(player.length).fill(1); for (let i = uniqueRanks.length - 1; i >= 0; i--) { while (player[pos] < uniqueRanks[i] && pos < player.length) { ans[pos] = i + 2; pos++; } } return ans; }
Seems like cookies are disabled on this browser, please enable them to open this website
Climbing the Leaderboard
You are viewing a single comment's thread. Return to all comments →