반응형

프로그래머스 12

[프로그래머스] 양과 늑대 [Level 3] (python 파이썬)

https://school.programmers.co.kr/learn/courses/30/lessons/92343 프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr    from collections import dequedef solution(info, edges): visit = [0 for i in range(len(info))] graph = [[] for i in range(len(info))] for edge in edges: graph[edge[0]].append(edge[1]) visit[0] = 1..

[프로그래머스] 다단계 칫솔 판매 [Level 3] (python 파이썬)

https://school.programmers.co.kr/learn/courses/30/lessons/77486 프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr       def solution(enroll, referral, seller, amount): d = {} graph = {} for i in range(len(referral)): d[enroll[i]] = referral[i] graph[enroll[i]] = 0 s = [] for i in range(len(amount)): s...

[프로그래머스] 베스트앨범[Level 3] (python 파이썬)

https://school.programmers.co.kr/learn/courses/30/lessons/42579 프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr def solution(genres, plays): d1 = {} d2 = {} s = {} for i in range(len(plays)): if genres[i] not in s: s[genres[i]] = plays[i] else: s[genres[i]] += plays[i] ..

[프로그래머스] 여행경로 [Level 3] (python 파이썬) [BFS]

https://school.programmers.co.kr/learn/courses/30/lessons/43164 프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr     from collections import dequedef solution(tickets): d= deque() n = len(tickets) for i in range(n): if tickets[i][0] == "ICN": visit = [0 for i in range(n)] visit..

[프로그래머스] 단어 변환 [Level 3] (python 파이썬) [DFS/BFS]

https://school.programmers.co.kr/learn/courses/30/lessons/43163 프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr       from collections import dequedef checkdiff(s1, s2): n = 0 for i in range(len(s1)): if s1[i] != s2[i]: n += 1 if n > 1: return 0 if n ==1: ..

[프로그래머스] 징검다리 건너기 [Level 3] (python 파이썬)

https://school.programmers.co.kr/learn/courses/30/lessons/64062 프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr            def solution(stones, k): stone_min = min(stones) stone_max = max(stones) if stone_min == stone_max: return stone_min while 1: n = 0 now = (s..

[프로그래머스] 불량 사용자 [Level 3] (python 파이썬)

https://school.programmers.co.kr/learn/courses/30/lessons/64064 프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr           from collections import dequedef solution(user_id, banned_id): l = [[] for i in range(len(banned_id))] for i in range(len(banned_id)): now = banned_id[i] for user in..

[프로그래머스] 메뉴 리뉴얼 [Level 2] (python 파이썬)

https://school.programmers.co.kr/learn/courses/30/lessons/72411 프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr        from itertools import combinationsdef solution(orders, course): ans = [] for i in course: d = {} for order in orders: for com in list(combinations(order, i)): ..

[프로그래머스] 등산코스 정하기 [Level 3] (python 파이썬)

https://school.programmers.co.kr/learn/courses/30/lessons/118669 프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr        from collections import dequedef solution(n, paths, gates, summits): summits = list(set(summits)) visited = [10000001 for i in range(n+1)] graph = [[] for i in range(n+1)] start = []..

[프로그래머스] 코딩 테스트 공부 [Level 3] (python 파이썬)

https://school.programmers.co.kr/learn/courses/30/lessons/118668 프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr                   def solution(alp, cop, problems): max_alp = 0 max_cop = 0 for i in problems: max_alp = max(max_alp, i[0]) max_cop = max(max_cop, i[1]) if max_alp ..

반응형