코딩 테스트
-
할인 행사코딩 테스트/Level 2 2022. 10. 28. 00:01
https://school.programmers.co.kr/learn/courses/30/lessons/131127 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr def solution(want, number, discount): answer = 0 to_buy = {a: b for a, b in zip(want, number)} for index in range(len(discount) - 9): temp = to_buy.copy() for each in discount[index:index + 10]: if each in temp: temp[each]..
-
프로그래머스 / 햄버거 만들기코딩 테스트/Level 1 2022. 10. 27. 23:25
https://school.programmers.co.kr/learn/courses/30/lessons/133502 파이썬 def solution(ingredient): stack = [] answer = 0 for each in ingredient: stack.append(each) if stack[-4:] == [1, 2, 3, 1]: answer += 1 del stack[-4:] return answer 코틀린 class Solution { fun solution(ingredient: IntArray): Int { var answer = 0 val bugger = listOf(1, 2, 3, 1) val stack = mutableListOf() for (each in ingredient) { s..
-
프로그래머스 / 옹알이 (2)코딩 테스트/Level 1 2022. 10. 27. 23:16
https://school.programmers.co.kr/learn/courses/30/lessons/133499 파이썬 def solution(babbling): answer = 0 for each in babbling: for index, text in enumerate(("aya", "ye", "woo", "ma")): each = each.replace(text, str(index)) if each.isdigit(): if '00' not in each: if '11' not in each: if '22' not in each: if '33' not in each: answer += 1 return answer 코틀린 class Solution { fun solution(babbling: Arr..
-
프로그래머스 / 콜라 문제코딩 테스트/Level 1 2022. 10. 27. 23:15
https://school.programmers.co.kr/learn/courses/30/lessons/132267 파이썬 def solution(a, b, n): answer = 0 while n >= a: quotient = n // a # 몫 new_bottle = quotient * b # 새 콜라 n -= a * quotient # 마트에 가져다 준 빈 병 answer += new_bottle n += new_bottle return answer import sys sys.setrecursionlimit(10000) def solution(a, b, n): if n < a: return 0 quotient = n // a new_bottle = quotient * b return new_bott..
-
프로그래머스 / 삼총사코딩 테스트/Level 1 2022. 10. 27. 23:14
https://school.programmers.co.kr/learn/courses/30/lessons/131705 파이썬 억지스럽게... from itertools import combinations solution = lambda number: sum(1 for each in combinations(number, 3) if sum(each) == 0) 정상적으로... from itertools import combinations def solution(number): return sum(1 for each in combinations(number, 3) if sum(each) == 0) 코틀린 class Solution { fun solution(number: IntArray): Int { var a..
-
프로그래머스 / 숫자 짝꿍코딩 테스트/Level 1 2022. 10. 27. 23:13
https://school.programmers.co.kr/learn/courses/30/lessons/131128 파이썬 억지스럽게... from collections import Counter solution = lambda num1, num2: ('0' if (result := ''.join(each * inter_n[each] for each in sorted(inter_n, reverse=True)))[0] == '0' else result) if (inter_n := Counter(list(num1)) & Counter(list(num2))) else "-1" 덜 억지스럽게... from collections import Counter def solution(num1, num2): return..
-
2017 카카오코드 예선: 보행자 천국코딩 테스트/Level 3 2022. 9. 13. 18:16
https://school.programmers.co.kr/learn/courses/30/lessons/1832 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 등굣길 문제의 업그레이드입니다. https://comdoc.tistory.com/entry/%EB%93%B1%EA%B5%A3%EA%B8%B8-%EB%8F%99%EC%A0%81%EA%B3%84%ED%9A%8D%EB%B2%95 (파이썬) 등굣길 - 동적계획법 https://programmers.co.kr/learn/courses/30/lessons/42898 코딩테스트 연습 - 등굣길 계속되는 폭우로 ..
-
566. Reshape the Matrix코딩 테스트/Level 1 2022. 9. 7. 17:36
https://leetcode.com/problems/reshape-the-matrix/ Reshape the Matrix - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com from typing import List class Solution: def matrixReshape(self, mat: List[List[int]], r: int, c: int) -> List[List[int]]: flat = tuple(each for row in mat for each..