nums = new int[]{1,1,2,3,4,4,4,4,5};
var groupS =nums.GroupBy(x => x);
// for detail view take look at below or click on source link
// https://leetcode.com/problems/majority-element/discuss/2657752/103-ms-faster-than-97.70-of-C-online-submissions-One-Liner