일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
- programmers
- 자바
- axios
- SW
- 매일메일
- 테코테코
- redux-saga
- 프로그래머스
- useDispatch
- createSlice
- 알고리즘
- Python
- sw expert academy
- 항해99
- json-server
- react
- react-router
- 이코테
- 리액트
- Get
- C++
- maeil-mail
- Algorithm
- java
- 항해플러스
- redux-toolkit
- JavaScript
- redux
- react-redux
- 코딩테스트합격자되기
- Today
- Total
목록프로그래머스/level 3 (6)
Binary Journey
![](http://i1.daumcdn.net/thumb/C150x150.fwebp.q85/?fname=https://blog.kakaocdn.net/dn/oz9ak/btrFAPEuAod/dXcRnHdmuKJbZdz22DYkK1/img.png)
출처: 프로그래머스 코딩 테스트 연습, https://programmers.co.kr/learn/challenges import heapq def solution(operations): answer = [] while operations: o, num = operations.pop(0).split() if o == "I": heapq.heappush(answer, int(num)) elif answer and o == "D" and int(num) > 0: answer.pop() elif answer and o == "D" and int(num) < 0: answer.pop(0) answer.sort() if answer: return [answer[-1], answer[0]] else: return [..
![](http://i1.daumcdn.net/thumb/C150x150.fwebp.q85/?fname=https://blog.kakaocdn.net/dn/euPuR8/btrCKi25UXX/ONT1JzAKK1HD4XCJYtmkwK/img.png)
출처: 프로그래머스 코딩 테스트 연습, https://programmers.co.kr/learn/challenges 사실 조건은 4개로 보아야 함 오랜만에 +2점...! from functools import cmp_to_key def cmp_sum(x, y): return y[1] - x[1] def cmp_by_condition(x, y): x_index, x_play = x y_index, y_play = y if x_play == y_play: return x_index - y_index else: return y_play - x_play def solution(genres, plays): answer = [] _dict1 = dict() _dict2 = dict() for i, (genre, p..
![](http://i1.daumcdn.net/thumb/C150x150.fwebp.q85/?fname=https://blog.kakaocdn.net/dn/qJJSi/btrz53BbQqJ/ypeSylVFOtmv2ppeIiMy10/img.png)
출처: 프로그래머스 코딩 테스트 연습, https://programmers.co.kr/learn/challenges ** 시도중 from collections import deque def solution(n, results): win_graph = [ [] for i in range(n + 1) ] lose_graph = [ [] for i in range(n + 1) ] wn_c = [ 0 for i in range(n + 1) ] for result in results: win_graph[result[0]].append(result[1]) lose_graph[result[1]].append(result[0]) queue = deque() queue.append(results[0][0]) answer..
![](http://i1.daumcdn.net/thumb/C150x150.fwebp.q85/?fname=https://blog.kakaocdn.net/dn/b7Csea/btrz0t87a9c/RGhsIpkW46DmHNgK0TZAcK/img.png)
출처: 프로그래머스 코딩 테스트 연습, https://programmers.co.kr/learn/challenges from collections import deque def solution(n, edge): graph = [[] for i in range(n + 1)] node_count = [0 for i in range(n + 1)] for i, e in enumerate(edge): graph[e[0]].append(e[1]) graph[e[1]].append(e[0]) node_count[1] = 1 queue = deque() queue.append(1) while queue: now = queue.popleft() for g in graph[now]: if node_count[g] == 0..
![](http://i1.daumcdn.net/thumb/C150x150.fwebp.q85/?fname=https://blog.kakaocdn.net/dn/ekUkY2/btrv9Jf81ID/GoEUkbKr6K3spoM34iRNGk/img.png)
출처: 프로그래머스 코딩 테스트 연습, https://programmers.co.kr/learn/challenges def solution(triangle): answer = triangle[0][0] if len(triangle) == 1: return answer d = [[0] * (i + 1) for i in range(len(triangle))] d[0][0] = triangle[0][0] for i in range(1, len(triangle)): for j in range(len(triangle[i])): if j == 0: # 삼각형 i열 0번째 d[i][j] = d[i-1][j] + triangle[i][j]; elif j == i: # 삼각형 i열 마지막 d[i][j] = d[i-1][..
![](http://i1.daumcdn.net/thumb/C150x150.fwebp.q85/?fname=https://blog.kakaocdn.net/dn/cWMPM3/btrbIIhdPdV/5Z6boSSS6PfVcEHbOFKx51/img.png)
출처: 프로그래머스 코딩 테스트 연습, https://programmers.co.kr/learn/challenges MySQL 문제들은 아쉽게도 점수가 없어 순위에 영향을 주지 않는다. SELECT ID, NAME, HOST_ID FROM PLACES WHERE HOST_ID IN ( SELECT HOST_ID FROM PLACES GROUP BY HOST_ID HAVING COUNT(*) > 1 ) ORDER BY ID ASC; 참고: https://thispointer.com/mysql-select-where-count-is-greater-than-one-solved/ MySQL Select where Count is greater than one [Solved] – thispointer.com In..