Problem 61092. Leaderboard Tracker

  • S is an m×n matrix of scores, where S(i,j) is the score of player j in match i.
  • cumScore is an m×1 vector containing the cumulative score of the current leader after each match.
  • leaderIdx is an m×1 vector of indices of the current leader.
Example:
S = [2 3 1; 1 2 3; 0 1 2];
[cumScore, leaderIdx] = leaderboard_tracker(S)
% cumScore = [3;5;6]
% leaderIdx = [2;2;2]
Hints:
  • Use cumsum to track cumulative scores.
  • Update the leader only if a player’s cumulative score exceeds the current leader.
  • In case of ties for a new leader, pick the lowest index.

Solution Stats

87.5% Correct | 12.5% Incorrect
Last Solution submitted on Dec 06, 2025

Solution Comments

Show comments

Problem Recent Solvers6

Suggested Problems

More from this Author1

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!