글
C# 최댓값과 최솟값(Split().Select(x => ), OrderBy, ToList())
프로그래밍
2023. 1. 23. 15:43
728x90
SMALL
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
'프로그래밍' 카테고리의 다른 글
프로그래머스 C# 콜라츠 추측(while, long, 1일 때 예외처리) 쉬움 (0) | 2023.01.23 |
---|---|
프로그래머스 C# 최대공약수와 최소공배수(for문) (0) | 2023.01.23 |
프로그래머스 C# 제일 작은 수 제거하기(array.where) (0) | 2023.01.23 |
프로그래머스 C# 평균 구하기(double) (0) | 2023.01.23 |
프로그래머스 C# 이상한 문자 만들기(Split, 공백 처리) (0) | 2023.01.23 |