코딩공부/프로그래머스 191

※[프로그래머스]Lv.2 호텔 대실 C#

https://school.programmers.co.kr/learn/courses/30/lessons/155651 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 소스코드 시간을 다루는 예약 같은 경우 orderby를 통해 시간순으로 정렬하여 끝시간과 첫 시간만 비교한다. using System; using System.Collections.Generic; using System.Linq; public class Solution { public int solution(string[,] book_time) { var roomList = new List();..

※[프로그래머스]Lv.2 미로 탈출 C#

https://school.programmers.co.kr/learn/courses/30/lessons/159993 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 소스코드 using System; using System.Collections.Generic; public class Solution { static Pos _end; public int solution(string[] maps) { int answerL = 0; int answerE = 0; Pos startPos = null; for (int i = 0; i < maps.Length; i++..

※[프로그래머스]Lv.2 과제 진행하기 C#

https://school.programmers.co.kr/learn/courses/30/lessons/176962 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 소스코드 처음에 문제를 풀 때 다음 문제설명에 있는 "진행 중이던 과제를 끝냈을 때, 잠시 멈춘 과제가 있다면, 멈춰둔 과제를 이어서 진행합니다." 부분이 잠시 멈춘 과제가 그다음 진행 중인 시간 안에 온전히 포함될 때 한번에 끝내야 하는 줄 알았다 만약 멈춰둔 과제가 10분이 남았고 진행 중이던 과제가 종료되고 다음 과제까지 5분이 남았다면 멈춰둔 과제는 -5분을 해줘야 하는 것 을 나중에 깨..

※[프로그래머스]Lv.2 요격 시스템 C# (List<(int, int)>)

https://school.programmers.co.kr/learn/courses/30/lessons/181188 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 소스코드 마지막 answer ++ 하는 이유는 마지막 미사일은 요격을 안항 상태로 반복문을 빠져나오기 때문이다. using System; using System.Collections.Generic; using System.Linq; public class Solution { public int solution(int[,] targets) { int answer = 0; List list = ne..

※[프로그래머스]Lv.1 문자열 내 마음대로 정렬하기 C#(OrderBy,ThenBy)

https://school.programmers.co.kr/learn/courses/30/lessons/12915 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 소스코드1 using System; public class Solution { public string[] solution(string[] strings, int n) { string temp = ""; for (int i = 0; i < strings.Length; i++) { for (int j = i + 1; j < strings.Length; j++) { int compare = strin..

[프로그래머스]Lv.1 시저 암호 C#

https://school.programmers.co.kr/learn/courses/30/lessons/12926 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 소스코드 public class Solution { public string solution(string s, int n) { string answer = ""; char[] chars = s.ToCharArray(); foreach (var item in chars) { int next = item + n; if (item == ' ') { answer += item; } else if (ite..

[프로그래머스]Lv.1 자릿수 더하기 C#

https://school.programmers.co.kr/learn/courses/30/lessons/12931 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 소스코드 using System; using System.Linq; public class Solution { public int solution(int n) { int answer = 0; while (n>0) { answer += n % 10; n = n / 10; } return answer; } }

[프로그래머스]Lv.1 정수 내림차순으로 배치하기 C# (OrderByDescending)

https://school.programmers.co.kr/learn/courses/30/lessons/12933 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 소스코드1 using System; using System.Linq; public class Solution { public long solution(long n) { char[] sArray = n.ToString().ToArray(); Array.Sort(sArray); Array.Reverse(sArray); return Convert.ToInt64(new string(sArray)); } ..

[프로그래머스]Lv.1 정수 제곱근 판별 C# (Sqrt)

https://school.programmers.co.kr/learn/courses/30/lessons/12934 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 소스코드 using System; public class Solution { public long solution(long n) { long answer = 0; double sqrt = Math.Sqrt(n); if (sqrt % 1 != 0) return -1; answer = (long)Math.Pow(sqrt + 1, 2); return answer; } }