You are viewing a single comment's thread. Return to all comments →
C# solution 2
public record Score(int Limit, int Break); public static List<int> breakingRecords(List<int> scores) { var min = scores .Aggregate(new Score(scores[0], 0), (acc, next) => next < acc.Limit ? new Score(next, acc.Break + 1) : acc); var max = scores .Aggregate(new Score(scores[0], 0), (acc, next) => next > acc.Limit ? new Score(next, acc.Break + 1) : acc); return new List<int> { max.Break, min.Break }; }
Seems like cookies are disabled on this browser, please enable them to open this website
Breaking the Records
You are viewing a single comment's thread. Return to all comments →
C# solution 2