코딩 테스트 맨텀 2023. 3. 9. 12:50
출처: 프로그래머스 코딩 테스트 연습 https://school.programmers.co.kr/learn/courses/30/lessons/42746 나의 풀이 using System; using System.Linq; using System.Text; public class Solution { public string solution(int[] numbers) { var enumer = numbers.Select(s => s.ToString()) .OrderByDescending(o => $"{o}{o}{o}"); bool isZero = true; var sb = new StringBuilder(); foreach(string str in enumer) { if(isZero && str == "0"..
코딩 테스트 맨텀 2023. 3. 4. 17:08
출처: 프로그래머스 코딩 테스트 연습 https://school.programmers.co.kr/learn/courses/30/lessons/1844 나의 풀이 using System; using System.Collections.Generic; class Solution { // 최단거리는 BFS가 유리. public int solution(int[,] maps) { int w = maps.GetLength(0); int h = maps.GetLength(1); var open = new Queue(); var parents = new Dictionary(); var dirs = new (int x, int y)[4]{(-1, 0), (1, 0), (0, -1), (0, 1)}; open.Enqueue..
코딩 테스트 맨텀 2023. 3. 3. 15:41
출처: 프로그래머스 코딩 테스트 연습 https://school.programmers.co.kr/learn/courses/30/lessons/84512 중복 순열 문제. 1. A, E, I, O, U로 만들 수 있는 모든 문자열 2. 길이는 1~5 3. 문자 중복가능 의 조건이라서 중복 순열로 모든 문자열 만들고 정렬하면 된다. 내 코드 using System; using System.Linq; using System.Collections.Generic; public class Solution { public int solution(string word) { var list = new List(); var arr = new char[5]{'A', 'E', 'I', 'O', 'U'}; for(int i =..
코딩 테스트 맨텀 2023. 1. 27. 16:04
출처: 프로그래머스 코딩 테스트 연습 https://school.programmers.co.kr/learn/courses/30/lessons/92334 나의 풀이 using System; using System.Linq; using System.Collections.Generic; public class Solution { public int[] solution(string[] id_list, string[] report, int k) { int[] answer = new int[] {}; var reportSet = id_list.ToDictionary(e => e, e => new HashSet()); var reportedSet = id_list.ToDictionary(e => e, e => new..
코딩 테스트 맨텀 2023. 1. 26. 00:10
출처: 프로그래머스 코딩 테스트 연습 https://school.programmers.co.kr/learn/courses/30/lessons/12977 나의 풀이 using System; using System.Collections.Generic; class Solution { public int solution(int[] nums) { int answer = 0; for(int a = 0; a < nums.Length; a++) { for(int b = 0; b < nums.Length; b++) { if(a
코딩 테스트 맨텀 2023. 1. 22. 19:10
출처: 프로그래머스 코딩 테스트 연습 https://school.programmers.co.kr/learn/courses/30/lessons/12901 나의 풀이 using System; public class Solution { public string solution(int a, int b) { string[] strArray = new string[7]{"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"}; DateTime time = new DateTime(2016, a, b); int index = (int)time.DayOfWeek; return strArray[index]; } } 다른사람풀이 using System; public class Solution ..