[Programmers] 프로그래머스 네트워크 Python
·
🔻PS/Programmers
https://school.programmers.co.kr/learn/courses/30/lessons/43162 프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr def solution(n, computers): answer = 0 graph = [[] for _ in range(n+1)] visited = [0 for _ in range(n+1)] for v, element in enumerate(computers): print(v, element) for i, e in enumerate(e..
[Programmers] 프로그래머스 추억 점수 Python
·
🔻PS/Programmers
https://school.programmers.co.kr/learn/courses/30/lessons/176963 프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr def solution(name, yearning, photo): # 이름 # 각 사람별 그리움 점수 # 사진에 담긴 이름 answer = [] score = {} for n, y in zip(name, yearning): score[n] = y for ph in photo: sum = 0 for p in ph..
[Programmers] 프로그래머스 단어 변환 Python
·
🔻PS/Programmers
https://school.programmers.co.kr/learn/courses/30/lessons/43163 프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr ❗풀이 방법1. 백트래킹으로 한 단어씩 비교한다.2. 현재 단어와 타겟 단어가 1자리만 다른지 can_change 함수로 판별한다.3. 가능하다면 다음 단계로 넘어간다4. 현재 단어가 최종 단어와 동일하다면 result를 dep와 비교하여 최솟값으로 업데이트한다  ❗코드def solution(begin, target, words): result = 10000 visited = [0 for ..
[Programmers] 프로그래머스 저주의 숫자 3 Python
·
🔻PS/Programmers
https://school.programmers.co.kr/learn/courses/30/lessons/120871 프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr def solution(n): num = [] i = 1 while len(num)
[Programmers] 프로그래머스 피보나치 수 Python
·
🔻PS/Programmers
https://school.programmers.co.kr/learn/courses/30/lessons/12945 프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr def solution(n): arr = [0, 1] for i in range(2, n+1): arr.append((arr[i-2] + arr[i-1])%1234567) return arr[-1]
[Programmers] 프로그래머스 이진 변환 반복하기 Python
·
🔻PS/Programmers
https://school.programmers.co.kr/learn/courses/30/lessons/70129 프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr def solution(s): cnt = 0 zero = 0 def binary(n): res = "" while n > 0: res = str(n % 2) + res n //= 2 return res while s != "1": n = s.count("0") s = s.repl..
[Programmers] 프로그래머스 이중우선순위큐 Python
·
🔻PS/Programmers
https://school.programmers.co.kr/learn/courses/30/lessons/42628 프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr  import heapqdef solution(operations): min_heap = [] max_heap = [] answer = [] for i in operations: op, data = i.split(" ") data = int(data) if op == "I": heapq.heap..
[Programmers] 프로그래머스 뉴스 클러스터링 Python
·
🔻PS/Programmers
https://school.programmers.co.kr/learn/courses/30/lessons/17677 프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr from collections import Counterdef solution(str1, str2): # J(A, B) -> 교집합 크기 / 합집합 크기 # A와 B가 공집합이면 1 str1_list = [] str2_list = [] for i in range(len(str1) - 1): temp = str1[i] + str1[i + 1] if t..
[Programmers] 프로그래머스 n진수 게임 Python
·
🔻PS/Programmers
https://school.programmers.co.kr/learn/courses/30/lessons/17687 프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr def solution(n, t, m, p): def convert(n, k): result = '' while n > 0: if str(n % k) == '10': result = 'A' + result elif str(n % k) == '11': result = 'B' + r..
[Programmers] 프로그래머스 외계인 사전 Python
·
🔻PS/Programmers
https://school.programmers.co.kr/learn/courses/30/lessons/120869 프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr from itertools import permutationsdef solution(spell, dic): permu_list = [] for p in list(permutations(spell, len(spell))): p = list(p) permu_list.append("".join(p)) for p in permu_list: if ..
_니지
'🔻PS/Programmers' 카테고리의 글 목록 (2 Page)