728x90
https://school.programmers.co.kr/learn/courses/30/lessons/120896
📝 나의 풀이
using System;
using System.Linq;
using System.Collections.Generic;
public class Solution {
public string solution(string s) {
string answer = "";
char[] arr = s.ToCharArray();
Array.Sort(arr);
List<int> tmp = new List<int>();
for(int i=0; i<s.Length; i++){
if(s.Count(f => (f == arr[i])).Equals(1)){
tmp.Add(i);
}
}
for(int i=0; i<tmp.Count; i++){
answer += arr[tmp[i]].ToString();
}
return answer;
}
}
728x90
'코딩테스트 > [C#] 프로그래머스' 카테고리의 다른 글
[프로그래머스 | C# | Lv.0] 특수문자 출력하기 (0) | 2023.10.09 |
---|---|
[프로그래머스 | C# | Lv.0] 외계행성의 나이 (0) | 2023.10.05 |
[프로그래머스 | C# | Lv.0] 2차원으로 만들기 (0) | 2023.10.03 |
[프로그래머스 | C# | Lv.0] 공백으로 구분하기 2 (0) | 2023.10.02 |
[프로그래머스 | C# | Lv.0] 문자열 잘라서 정렬하기 (0) | 2023.10.01 |