This is sample in C#
// sample array
Tuple<string, int>[] arr = new Tuple<string, int>[]
{
new Tuple<string, int>("AA", 10),
new Tuple<string, int>("AA", 20),
new Tuple<string, int>("BB", 10),
new Tuple<string, int>("BB", 60)
};
// calcs
var result = arr.GroupBy(a => a.Item1)
.Select(g => new {Key = g.Key, S = g.Select(s => s.Item2).Sum()})
.OrderByDescending(g => g.S)
.FirstOrDefault();
// or
var result1 =
(from tuple in arr
group tuple by tuple.Item1 into gr
let s = gr.Select(s => s.Item2).Sum()
orderby s descending
select new {x = gr, y = s}).FirstOrDefault();