SHARE
TWEET

Untitled

a guest Dec 8th, 2019 111 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2. using System.Linq;
  3.  
  4. namespace ConsoleApp1
  5. {
  6.     class Program
  7.     {
  8.         static void Main(string[] args)
  9.         {
  10.             var nums = new []{ 7, 2, 5, 5, 7, 6, 7 };
  11.             var ans = 0;
  12.  
  13.             nums.GroupBy(x => x).Select(x =>
  14.             {
  15.                 ans += x.Key;
  16.                 return x.Key;
  17.             });
  18.  
  19.             Console.WriteLine(ans);
  20.         }
  21.     }
  22. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top