프로그래머스 5

[프로그래머스 1단계] 크기가 작은 부분 문자열

https://school.programmers.co.kr/learn/courses/30/lessons/147355 프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr def solution(t, p): answer = 0 subStr = [t[i: i+len(p)] for i in range(0, len(t)-len(p)+1)] for j in subStr : if(int(j)  파이썬 슬라이스와 List Comprehensions를 활용하였다.List Comprehensions을 사용하니 코드가 간결하다.

[프로그래머스 1단계] 카드 뭉치

https://school.programmers.co.kr/learn/courses/30/lessons/159994 프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr def solution(cards1, cards2, goal): answer = '' inCards1Count = 0 inCards2Count = 0 subGoal = [] for i in range(0, len(goal)): if(goal[i] in cards1) : subGoal.append(cards1[inCards1Count]) ..

[프로그래머스 1단계] 가장 가까운 글자

https://school.programmers.co.kr/learn/courses/30/lessons/142086 프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr def solution(s): answer = [] checkArr = '' for i in s : if i in checkArr : a = checkArr.rfind(i); checkArr += i; b = checkArr.rfind(i); num = b - a;..

[프로그래머스 1단계] 푸드 파이트 대회

https://school.programmers.co.kr/learn/courses/30/lessons/134240 프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr def solution(food): answer = '' subAnswer = '' for i in range(1, len(food)) : eatingCount = food[i] // 2; if(eatingCount > 0): answer += str(i) * eatingCount subAnswer += str(i) *..

[프로그래머스 1단계] - 추억 점수

https://school.programmers.co.kr/learn/courses/30/lessons/176963 프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr def solution(name, yearning, photo): answer = [] for i in photo : sum = 0 for j in i : if j in name : valueIndex = name.index(j); sum += yearning[valueIndex]; ..