Sort by

recency

|

2398 Discussions

|

  • + 0 comments

    For Java, using the knowledge that the ranked List is already sorted in descending order:

    `public static List climbingLeaderboard(List ranked, List player) { // Write your code here final var rankingMap = new TreeMap(Comparator.naturalOrder().reversed()); int currentRank = 1; for (Integer rank : ranked) { if (!rankingMap.containsKey(rank)) { rankingMap.put(rank, currentRank); currentRank++; } }

        return player.stream().map(score -> {
            final var lowerEntry = rankingMap.lowerEntry(score);
            if (lowerEntry == null) {
                return 1;
            }
            return lowerEntry.getValue() + 1;
            }).collect(Collectors.toList());
    }
    
  • + 0 comments

    It’s a great way to push yourself, measure progress, and celebrate small victories along the way. Ekbet86 Com

  • + 0 comments

    Locksmith in Selby is climbing the leaderboard by delivering reliable, fast, and professional locksmith services. With a focus on customer satisfaction, they handle everything from emergency lockouts to advanced security installations. Their dedication to quality workmanship and transparent pricing sets them apart in the industry. Whether for residential, commercial, or automotive needs, Locksmith in Selby continues to rise as a trusted name, helping clients feel secure and supported around the clock.

  • + 0 comments

    Getting "timeout" when submitting, your need to improve your code's performance. I resolved my timeout test cases by using a customized binary search to find the ranking for a play score. Cheers!

  • + 0 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;
    }