코딩테스트/[C#] 프로그래머스

[프로그래머스 | C# | Lv.0] 문자열 잘라서 정렬하기

냠냠쿠 2023. 10. 1. 14:33
728x90

 

https://school.programmers.co.kr/learn/courses/30/lessons/181866

 

 

📝 나의 풀이

using System;
using System.Collections.Generic;
using System.Linq;

public class Solution {
    public string[] solution(string myString) {
        string[] answer = myString.Split('x');
        
        //공백제거
        answer = answer.Where(x => !string.IsNullOrEmpty(x)).ToArray();
        Array.Sort(answer);
        return answer;
    }
}

 

728x90