목록Algorithms (64)
from collections import Counter A = int(input()) B = int(input()) C = int(input()) res = A*B*C res = str(res) cnt = Counter(res) for i in range(0,10): i = str(i) print(cnt[i]) # Counter 사용법 익히기 -> var = Counter(list) -> 각 요소 개수 출력 ################## from collections import Counter A = int(input()) B = int(input()) C = int(input()) res = str(A*B*C) for i in range(0,10): i = str(i) print(res.count..
n = int(input()) count = 0 while True: if n % 5 == 0: count += n//5 print(count) break n = n-3 count += 1 if n < 0: print(-1) break
from collections import deque def solution(skill, skill_trees): answer = 0 for i in skill_trees: temp = deque() for j in i: if j in skill: temp.append(j) cnt = 0 n = len(temp) temp2 = deque(skill) while temp: if temp.popleft() == temp2.popleft(): cnt+=1 if cnt == n: answer+=1 return answer # cnt 와 n 비교를 while 문안에서 실행해서 실패 발생한 것 수정 ############# 다른사람 풀이 ############# def solution(skill, skill_tre..
출처: https://programmers.co.kr/learn/courses/30/lessons/42628 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr ------ 첫풀이: def solution(operations): q = [] ops = [] for i in operations: if i[0] == 'I': q.append(int(i[2:])) else: ops.append(int(i[-1])) q.sort(reverse=True) if len(ops) >= len(q): return [0,0] else: for i in ops: if i == ..
출처: https://programmers.co.kr/learn/courses/30/lessons/42627/solution_groups?language=python3 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr import heapq def solution(jobs): answer = 0 n = len(jobs) time, end, data = 0, -1, [] cnt = 0 while cnt < n: for i in jobs: if end < i[0] 0: answer += len(data) * data[0] end = time time += hea..
출처: https://programmers.co.kr/learn/courses/30/lessons/42629 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 라면 공장에서는 운송비를 줄이기 위해 최소한의 횟수로 밀가루를 공급받고 싶습니다. stock 값을 빼는 것이 아님!! 최대 공급량을 가진 날짜 순으로 공급을 받아야 함! ----------- import heapq def solution(stock, dates, supplies, k): answer = 0 idx = 0 heap = [] while stock