[프로그래머스 | 파이썬 / 자바스크립트] 추억 점수(연습문제 / level 1)
·
Problem Solving/프로그래머스
문제 https://school.programmers.co.kr/learn/courses/30/lessons/176963 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 🐍파이썬 def solution(name, yearning, photo): answer = [] dic = {name:yearning for name, yearning in zip(name, yearning)} for i in range(len(photo)): answer.append(0) for j in photo[i]: if j in dic.keys(): answer[i] += dic[..
[프로그래머스 | 파이썬 / 자바스크립트] 평행(코딩테스트 입문 / level 0)
·
Problem Solving/프로그래머스
문제 https://school.programmers.co.kr/learn/courses/30/lessons/120875 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 🐍파이썬 def solution(dots): if (dots[0][1] - dots[1][1]) / (dots[0][0] - dots[1][0]) == (dots[2][1] - dots[3][1]) / (dots[2][0] - dots[3][0]) or (dots[0][1] - dots[2][1]) / (dots[0][0] - dots[2][0]) == (dots[1][1] - dots[3..
[프로그래머스 | 파이썬 / 자바스크립트] 다리를 지나는 트럭(스택/큐 / level 2)
·
Problem Solving/프로그래머스
문제 https://school.programmers.co.kr/learn/courses/30/lessons/42583 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 🐍파이썬 더보기 ❌ 실패한 코드 from collections import deque def solution(bridge_length, weight, truck_weights): answer = 0 truck_weights = deque(truck_weights) ing = deque(0 for i in range(bridge_length)) while ing: answer += 1 ing...
[프로그래머스 | 파이썬 / 자바스크립트] [3차] 파일명 정렬(2018 KAKAO BLIND RECRUITMENT / level 2)
·
Problem Solving/프로그래머스
문제 https://school.programmers.co.kr/learn/courses/30/lessons/17686 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 🐍파이썬 def solution(files): answer = [] head = '' number = '' tail = '' for i in files: for j in range(len(i)):#파일의 문자를 하나씩 확인 if i[j].isdigit():#숫자가 나오면 head = i[:j]#숫자 앞까지 끊어서 head number = i[j:]#숫자부터는 number for k in ra..
[프로그래머스 | 파이썬 / 자바스크립트] 덧칠하기(연습문제 / level 2)
·
Problem Solving/프로그래머스
문제 https://school.programmers.co.kr/learn/courses/30/lessons/161989 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 🐍파이썬 def solution(n, m, section): answer = 0 while section: e = section[0] while section and e
[프로그래머스 | 파이썬 / 자바스크립트] 겹치는 선분의 길이(코딩테스트 입문/ level 0)
·
Problem Solving/프로그래머스
문제 https://school.programmers.co.kr/learn/courses/30/lessons/120876 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 🐍파이썬 def solution(lines): answer = 0 setArr = [0 for _ in range(200)] for i in lines: for j in range(i[0] ,i[1]): setArr[j + 100] += 1 return setArr.count(2) + setArr.count(3) 1️⃣ 문제조건 중 -100 ≤ a < b ≤ 100라는 조건이 존재하기 때문..
[프로그래머스 | 파이썬 / 자바스크립트] [3차] 압축(2018 KAKAO BLIND RECRUITMENT/ level 2)
·
Problem Solving/프로그래머스
문제 https://school.programmers.co.kr/learn/courses/30/lessons/17684 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 🐍파이썬 def solution(msg): answer = [] dic = {chr(i+ord("A")-1):i for i in range(1, 27)} idx = 27 checkMsg = ""#w for i in msg: checkMsg += i#w+c if checkMsg not in dic: answer.append(dic[checkMsg[:-1]]) dic[checkMsg] = idx..
[프로그래머스 | 파이썬 / 자바스크립트] 롤케이크 자르기(연습문제/ level 2)
·
Problem Solving/프로그래머스
문제 https://school.programmers.co.kr/learn/courses/30/lessons/132265 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 🐍파이썬 from collections import Counter def solution(topping): answer = 0 toppingDic = Counter(topping)#사전 형식으로 (원소:원소갯수)가 저장된다. toppingSet = set() for i in topping: toppingDic[i] -= 1#사전에서는 -1로 토핑종류를 1감소시킨다. toppingSet.ad..
[프로그래머스 | 파이썬 / 자바스크립트] 영어가 싫어요(코딩테스트 입문/ level 0)
·
Problem Solving/프로그래머스
문제 https://school.programmers.co.kr/learn/courses/30/lessons/120894 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 🐍파이썬 def solution(numbers): alpha = ["zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"] for i, j in zip(alpha, range(10)): numbers = numbers.replace(i, str(j)) return int(numbers) 더보기 def so..