프로그래밍

프로그래머스 C# 문자열 내 마음대로 정렬하기(string.OrderBy(), Linq)

노마드선샤인 2023. 1. 22. 20:23
728x90
SMALL

using System.Linq;

public class Solution {
    public string[] solution(string[] strings, int n) {
        string[] answer = new string[] {};
        
        answer = strings.OrderBy(x => x).OrderBy(x => x[n]).ToArray();
        
        return answer;
    }
}

728x90