728x90
반응형
class Result
{
/*
* Complete the 'miniMaxSum' function below.
*
* The function accepts INTEGER_ARRAY arr as parameter.
*/
public static void miniMaxSum(List<int> arr)
{
arr.Sort();
long minSum = arr.Take(4).Sum();
long maxSum = arr.Skip(1).Take(4).Sum();
Console.WriteLine($"{minSum} {maxSum}");
}
}
728x90
반응형
'HackerRank' 카테고리의 다른 글
Tree: Preorder Traversal (0) | 2023.10.04 |
---|---|
Tree: Postorder Traversal (0) | 2023.10.04 |
Diagonal Difference C# (0) | 2023.10.04 |
Lonely Integer C# (0) | 2023.10.04 |
Plus Minus C# (0) | 2023.10.04 |