일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- C++
- useDispatch
- 자바
- sw expert academy
- react-router
- java
- react-redux
- 매일메일
- createSlice
- 항해플러스
- 이코테
- Get
- 알고리즘
- programmers
- 테코테코
- 코딩테스트합격자되기
- 프로그래머스
- redux
- Python
- Algorithm
- redux-toolkit
- JavaScript
- redux-saga
- maeil-mail
- axios
- react
- 리액트
- json-server
- 항해99
- SW
- Today
- Total
목록전체 글 (302)
Binary Journey
출처: 프로그래머스 코딩 테스트 연습, https://programmers.co.kr/learn/challenges ** Python from collections import deque visited = [] r, c = 0, 0 NORTH, SOUTH, EAST, WEST = 0, 1, 2, 3 def get_next_step(to, y, x): if to == NORTH: return y+1, x elif to == SOUTH: return y-1, x elif to == WEST: return y, x-1 else: return y, x+1 def get_next_to(to, ny, nx, grid): if to == NORTH: if grid[ny][nx] == 'L': return WEST e..
출처: 프로그래머스 코딩 테스트 연습, https://programmers.co.kr/learn/challenges ** Python def get_uv(p): a = 0 for i, e in enumerate(p): if e == "(": a += 1 else: a -= 1 if a == 0: return p[:i+1], p[i+1:] def is_u_right(u): stack = [] for p in u: if p == '(': stack.append(p) else: if not stack: return False stack.pop() return True def solution(p): if p == "": return p u, v = get_uv(p) if is_u_right(u): return ..
** Python def solution(s): tmp_s = s answer = 0 if len(s) % 2 == 1: return answer for i in range(len(s)): tmp_list = [] for t in tmp_s: if t in "({[": tmp_list.append(t) elif t == ")" and len(tmp_list) > 0 and tmp_list[-1] == "(": tmp_list.pop() elif t == "}" and len(tmp_list) > 0 and tmp_list[-1] == "{": tmp_list.pop() elif t == "]" and len(tmp_list) > 0 and tmp_list[-1] == "[": tmp_list.pop() ..
function solution(id_list, report, k) { let members = {}; for (const r of report) { const [ reporter, reportee ] = r.split(" "); if (members[reportee]) { if (!members[reportee][1].includes(reporter)) { members[reportee][0]++; members[reportee][1].push(reporter); members[reportee][1] = [ ...new Set(members[reportee][1])]; } } else { members[reportee] = [1, [reporter]]; } } let answer = new Array(..
출처: 프로그래머스 코딩 테스트 연습, https://programmers.co.kr/learn/challenges ** Python Christopher 님의 도움을 받음 def solution(skill, skill_trees): answer = 0 for skill_tree in skill_trees: skill_t = [ s for s in skill_tree if s in skill] skt = ''.join(skill_t) if skill.find(skt) == 0: answer += 1 return answer
출처: 프로그래머스 코딩 테스트 연습, https://programmers.co.kr/learn/challenges 월간코드챌린지 때 효율성에서 막혀서 결국 못 풀었는데 풀이 보고 너무나도 간단해서 놀랐다. 1차원 배열을 n 으로 나눈 몫, 나머지에서 max 값만 구하면 되다니.. ** python def solution(n, left, right): answer = [] for i in range(left, right + 1): answer.append(max(divmod(i, n)) + 1) return answer 참고: https://sangsangss.tistory.com/197 [프로그래머스] n^2 배열 자르기 https://programmers.co.kr/learn/courses/30/le..
출처: 프로그래머스 코딩 테스트 연습, https://programmers.co.kr/learn/challenges ** Python 코드 실행에서는 통과됐는데 채점에서 35퍼 나와서 뭐가 문제인가 했는데 질문하기에 방향성이 없어야 한다는 말에 깨달음 (1,1) -> (0,1) 이랑 (0,1) -> (1,1) 은 같은 길을 갔으므로 카운트 되면 안됨 def solution(dirs): answer = 0 loc = [0, 0] strd = {'U': (0, 1), 'D': (0, -1), 'R': (1, 0), 'L': (-1, 0)} visited = set() for d in dirs: old_x = loc[0] old_y = loc[1] new_x = loc[0] + strd[d][0] new_y ..
출처: 프로그래머스 코딩 테스트 연습, https://programmers.co.kr/learn/challenges ** Python 1) 1차 시도 (실패 73.3/100) from datetime import timedelta def replace_melody(melody): return melody\ .replace('C#', 'Z')\ .replace('D#', 'Y')\ .replace('F#', 'X')\ .replace('G#', 'W')\ .replace('A#', 'V') def cal_time_diff(start, end): start_hour, start_min = map(int, start.split(":")) start_time = timedelta(hours=start_hour,..
* 상하좌우 n = int(input()) a = input().split() _dict = { 'R': (0, 1), 'L': (0. -1), 'U': (-1, 0), 'D': (1, 0) } location_v = 1 location_h = 1 while a: direction = a.pop(0) if direction == 'R' and location_h == n: pass elif direction == 'L' and location_h == 1: pass elif direction == 'U' and location_v == 1: pass elif direction == 'D' and location_v == n: pass else: location_v += _dict[direction][0]..
출처: 프로그래머스 코딩 테스트 연습, https://programmers.co.kr/learn/challenges import re def solution(files): reg = [re.split(r'(\d+)', s) for s in files] reg.sort(key = lambda x: (x[0].lower(), int(x[1]))) return [''.join(s) for s in reg] 참고: https://velog.io/@sem/%ED%94%84%EB%A1%9C%EA%B7%B8%EB%9E%98%EB%A8%B8%EC%8A%A4-LEVEL2-%ED%8C%8C%EC%9D%BC%EB%AA%85-%EC%A0%95%EB%A0%AC-Python [프로그래머스] LEVEL2 파일명 정렬 (Python..