We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
  • Hackerrank Home
  • Prepare
    NEW
  • Certify
  • Compete
  • Career Fair
  • Hiring developers?
  1. Prepare
  2. Algorithms
  3. Warmup
  4. Mini-Max Sum
  5. Discussions

Mini-Max Sum

Problem
Submissions
Leaderboard
Discussions
Editorial

    You are viewing a single comment's thread. Return to all comments →

  • luumanhlapdi
    5 years ago+ 15 comments

    My solution in c# :D

    string[] arr_temp = Console.ReadLine().Split(' ');
                long[] arr = Array.ConvertAll(arr_temp, Int64.Parse);
                long result1 = 0;
                long result2 = 0;
                long max = arr.Max();
                long min = arr.Min();
                for (int i = 0; i < arr.Length; i++)
                {
                    result1 += arr[i];
                    result2 += arr[i];
                }
                Console.WriteLine("{0} {1}",result1 - max,result2 - min);
    
    19|
    Permalink
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy
  • Request a Feature