프로그래머스/프로그래머스 Lv2

[C#]프로그래머스/최댓값과 최솟값

ENUM01 2023. 5. 28. 21:18

 

1
2
3
4
5
6
7
8
9
10
11
using System.Linq;
 
public class Solution
{
    public string solution(string s)
    {
        int[] intArrays = s.Split().Select(int.Parse).ToArray();
 
        return $"{intArrays.Min()} {intArrays.Max()}";
    }
}
cs

 

* Split()에 매개변수가 없으면 공백문자를 기준으로 문자열을 분리한다.