프로그래밍
C# 최댓값과 최솟값(Split().Select(x => ), OrderBy, ToList())
노마드선샤인
2023. 1. 23. 15:43
728x90
using System.Collections.Generic;
using System.Linq;
public class Solution {
public string solution(string s) {
string answer = "";
List<int> list = s.Split().Select(x => System.Convert.ToInt32(x)).OrderBy(x => x).ToList();
answer = list.First() + " " + list.Last();
return answer;
}
}
728x90