코딩공부 221

[프로그래머스]Lv.1 가장 가까운 같은 글자 C#

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

[프로그래머스]Lv.1 개인정보 수집 유효기간 C#

https://school.programmers.co.kr/learn/courses/30/lessons/150370 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 소스코드 using System; using System.Collections.Generic; public class Solution { public int[] solution(string today, string[] terms, string[] privacies) { List answer = new List(); DateTime todayDt = DateTime.Parse(today); Dic..

[프로그래머스]Lv.1 둘만의 암호C#

https://school.programmers.co.kr/learn/courses/30/lessons/155652 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 소스코드 using System; public class Solution { public string solution(string s, string skip, int index) { string answer = ""; foreach (char ch in s) { char temp = ch; int count = 0; while (count < index) { temp = (char)(temp +..

[프로그래머스]Lv.1 카드 뭉치 C#

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

※[프로그래머스]Lv.1 대충 만든 자판 C#

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

※[프로그래머스]Lv.1 덧칠하기 C#

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

※[프로그래머스]Lv.1 공원 산책 C#

https://school.programmers.co.kr/learn/courses/30/lessons/172928 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 소스코드 using System; public class Solution { int maxX = 0; int maxY = 0; public int[] solution(string[] park, string[] routes) { maxX = park[0].Length; maxY = park.Length; int[] answer = new int[2]; int x = 0; int y = 0; for..

※[프로그래머스]Lv.1 크기가 작은 부분문자열 C#(long.parse)

https://school.programmers.co.kr/learn/courses/30/lessons/147355 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 소스코드 형변환을 int.parse로 했다가 시간초 에러가 났다 알고 보니 제한사항에 1 ≤ p의 길이 ≤ 18을 생각하지 않고 int.parse로 해서 나는 오류였다. 제한사항을 잘 확인해 봐야겠다. using System; public class Solution { public int solution(string t, string p) { int answer = 0; long ip = lon..

※[프로그래머스]Lv.1 달리기 경주 C#(dictionary)

https://school.programmers.co.kr/learn/courses/30/lessons/178871 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 소스코드 using System; using System.Collections.Generic; using System.Linq; public class Solution { public string[] solution(string[] players, string[] callings) { Dictionary dic = players.Select((s, idx) => new { name = s, in..

[프로그래머스]Lv.0 특정 문자열로 끝나는 가장 긴 부분 문자열 찾기 C#(LastIndexOf, Substring)

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