// 2026년 포트폴리오용 재구성 코드. 실제 업무 당시 소스가 아닙니다. // 2026 portfolio reconstruction. Not original production source. In-memory model; persistence is a separate adapter. using System; using System.Collections.Generic; namespace PortfolioExamples { public sealed class LocalLeaderboard { readonly Dictionary best = new Dictionary(); public void Submit(string player, int score) { if (string.IsNullOrWhiteSpace(player) || score < 0) throw new ArgumentException("Invalid score entry."); if (!best.TryGetValue(player, out int previous) || score > previous) best[player] = score; } public List> Top(int count) { if (count < 0) throw new ArgumentOutOfRangeException(nameof(count)); var rows = new List>(best); rows.Sort((a,b) => a.Value != b.Value ? b.Value.CompareTo(a.Value) : StringComparer.Ordinal.Compare(a.Key,b.Key)); return rows.GetRange(0, Math.Min(count, rows.Count)); } } }