coding test(62)
-
[coding test] Programmers_level 1_로또의 최고 순위와 최저 순위
▶ Programmers_level 1_로또의 최고 순위와 최저 순위 - 프로그래머스: programmers - 코딩 및 결과: github #programmers_level 1_로또의 최고 순위와 최저 순위 ### 2개가 지워진 로또번호를 받고 당첨될수 있는 최대, 최저 등수를 출력 def solution(lottos, win_nums): rank=[6,6,5,4,3,2,1] # 순위 정의 zero = lottos.count(0) # lottos에 0이 몇개 있는지 카운트 hit = sum([i in lottos for i in win_nums]) # 맞힌 수 카운트 return rank[zero+hit],rank[hit] # 최대: 맞힌수+0개수 / 최소: 맞힌수 solution([44, 1, 0, ..
2021.06.19 -
[coding test] Programmers_level 1_키패드 누르기
▶ Programmers_level 1_키패드 누르기 - 프로그래머스: programmers - 코딩 및 결과: github JeongJaeyoung0/coding_test 코딩테스트. Contribute to JeongJaeyoung0/coding_test development by creating an account on GitHub. github.com def solution(numbers, hand): answer = '' l_hand ,r_hand = 10, 12 # 왼손, 오른손 시작 위치 for i in numbers: # 키패드 누를 값 for문 if i in [1, 4, 7]: # 1, 4, 7은 왼손 answer += "L" l_hand = i # 왼손 위치 elif i in [3, 6..
2021.06.18 -
[coding test] Programmers_level 1_1차 비밀지도
▶ Programmers_level 1_1차 비밀지도 - 프로그래머스: programmers - 코딩 및 결과: github JeongJaeyoung0/coding_test 코딩테스트. Contribute to JeongJaeyoung0/coding_test development by creating an account on GitHub. github.com def solution(n, arr1, arr2): answer = [] # 정답 지도 리스트 map1 = [bin(i)[2:].zfill(n) for i in arr1] # 첫 번째 지도 row별 2진수 변환 후 리스트 저장 map2 = [bin(i)[2:].zfill(n) for i in arr2] # 두 번째 지도 row별 2진수 변환 후 리스..
2021.06.17 -
[coding test] Programmers_level 1_크레인 인형뽑기 게임
▶ Programmers_level 1_크레인 인형뽑기 게임 - 프로그래머스: programmers - 코딩 및 결과: github JeongJaeyoung0/coding_test 코딩테스트. Contribute to JeongJaeyoung0/coding_test development by creating an account on GitHub. github.com def solution(board, moves): basket=[0] # 인형을 담을 basket list answer=0 # 터진 인형 수 for i in moves: # 뽑을 인형 리스트 for문 for j in range(len(board)): # 뽑을 인형 상위에서 아래로 for문 move = board[j][i-1] # board의 ..
2021.06.16 -
[coding test] Programmers_level 1_이상한 문자 만들기
▶ Programmers_level 1_이상한 문자 만들기 - 프로그래머스: programmers - 코딩 및 결과: github JeongJaeyoung0/coding_test 코딩테스트. Contribute to JeongJaeyoung0/coding_test development by creating an account on GitHub. github.com # Programmers_level 1_이상한 문자 만들기 ### 단어별 짝수자리: 대문자, 홀수자리: 소문자 # 풀어 쓴 형태 def solution(s): a = s.split(' ') # 단어별 끊기 text=[] # text 담을 list for x in range(len(a)): # 단어 수 만큼 for문 text1 = [] # tex..
2021.06.15 -
[coding test] Baekjoon_level 12_정렬-4
Ver. Jupyter Notebook (Anaconda3) ▶ coding test_Baekjoon_level 12_정렬-4 - 백준: baekjoon - 코딩 및 결과: github JeongJaeyoung0/coding_test 코딩테스트. Contribute to JeongJaeyoung0/coding_test development by creating an account on GitHub. github.com ### 2021.06.14 # coding test_Baekjoon_level 12_정렬-4 # 1181 (단어 정렬)-1 a=set([input() for _ in[0]*int(input())]) b=[[len(i),i]for i in a] b.sort(key=lambda x:x[1]) ..
2021.06.14