일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 | 29 | 30 | 31 |
- React
- Cypress
- autosize
- map
- ESlint
- RTK Query
- 무한 스크롤
- webpack
- async/await
- 반공변성
- SSR
- 이분 검색
- useAppDispatch
- 인터섹션
- Promise
- recoil
- app router
- 타입 좁히기
- 공변성
- dfs
- tailwind
- 태그된 유니온
- CI/CD
- Jest
- 호이스팅
- 결정 알고리즘
- 투포인터
- TS
- CORS
- 리터럴 타입
- Today
- Total
목록코딩 테스트(Python)/백준, 프로그래머스 (77)
짧은코딩
https://www.acmicpc.net/problem/1181 1181번: 단어 정렬 첫째 줄에 단어의 개수 N이 주어진다. (1 ≤ N ≤ 20,000) 둘째 줄부터 N개의 줄에 걸쳐 알파벳 소문자로 이루어진 단어가 한 줄에 하나씩 주어진다. 주어지는 문자열의 길이는 50을 넘지 않는다. www.acmicpc.net 내 풀이(맞음) n = int(input()) ary = [] for i in range(n): x = input() if x not in ary: ary.append(x) cnt = [] #(길이, 문자) for i in range(len(ary)): t = ary[i] cnt.append((len(t), t)) cnt.sort() for i in range(len(cnt)): pri..
https://www.acmicpc.net/problem/1157 1157번: 단어 공부 알파벳 대소문자로 된 단어가 주어지면, 이 단어에서 가장 많이 사용된 알파벳이 무엇인지 알아내는 프로그램을 작성하시오. 단, 대문자와 소문자를 구분하지 않는다. www.acmicpc.net 내 풀이(맞음) x = input() x = x.upper() dic = {} for i in range(len(x)): if x[i] not in dic: dic[x[i]] = 1 else: dic[x[i]] += 1 dic = sorted(dic.items(), key = lambda x: x[1], reverse=True) if len(x) > 1: if dic[0][1] == dic[1][1]: print("?") else..
https://www.acmicpc.net/problem/14425 14425번: 문자열 집합 첫째 줄에 문자열의 개수 N과 M (1 ≤ N ≤ 10,000, 1 ≤ M ≤ 10,000)이 주어진다. 다음 N개의 줄에는 집합 S에 포함되어 있는 문자열들이 주어진다. 다음 M개의 줄에는 검사해야 하는 문자열들이 주어 www.acmicpc.net 내 풀이(맞음) n, m = map(int, input().split()) ary = [] for i in range(n): ary.append(input()) count = 0 for i in range(m): x = input() if x in ary: count += 1 print(count) 사실 이 문제는 단순히 배열에 값이 있냐 없냐를 비교하면서 풀었다...
https://www.acmicpc.net/problem/2161 2161번: 카드1 N장의 카드가 있다. 각각의 카드는 차례로 1부터 N까지의 번호가 붙어 있으며, 1번 카드가 제일 위에, N번 카드가 제일 아래인 상태로 순서대로 카드가 놓여 있다. 이제 다음과 같은 동작을 카드가 www.acmicpc.net 내 풀이(맞음) from collections import deque n = int(input()) ary = deque(i for i in range(1, n+1)) cnt = [] while ary: cnt.append(ary.popleft()) if ary: t = ary.popleft() ary.append(t) for i in cnt: print(i, end = " ") deque를 이용..
https://www.acmicpc.net/problem/2606 2606번: 바이러스 첫째 줄에는 컴퓨터의 수가 주어진다. 컴퓨터의 수는 100 이하이고 각 컴퓨터에는 1번 부터 차례대로 번호가 매겨진다. 둘째 줄에는 네트워크 상에서 직접 연결되어 있는 컴퓨터 쌍의 수가 주어 www.acmicpc.net 내 풀이(맞춤) from collections import deque n = int(input()) m = int(input()) dic = {} for i in range(m): a, b = map(int, input().split()) if a not in dic: dic[a] = [b] else: dic[a].append(b) if b not in dic: dic[b] = [a] else: dic..
https://www.acmicpc.net/problem/2667 2667번: 단지번호붙이기 과 같이 정사각형 모양의 지도가 있다. 1은 집이 있는 곳을, 0은 집이 없는 곳을 나타낸다. 철수는 이 지도를 가지고 연결된 집의 모임인 단지를 정의하고, 단지에 번호를 붙이려 한다. 여 www.acmicpc.net 내 풀이(결국 구글링을 해서 이해했다ㅜㅜ) from collections import deque n = int(input()) ary = [] for i in range(n): ary.append(list(map(int, input()))) #상하좌우 dx = [-1, 1, 0, 0] dy = [0, 0, -1, 1] def bfs(x, y): q = deque() q.append((x, y)) a..
https://www.acmicpc.net/problem/2178 2178번: 미로 탐색 첫째 줄에 두 정수 N, M(2 ≤ N, M ≤ 100)이 주어진다. 다음 N개의 줄에는 M개의 정수로 미로가 주어진다. 각각의 수들은 붙어서 입력으로 주어진다. www.acmicpc.net 내 풀이(큐를 생각 못했다ㅠㅠ) from collections import deque n, m = map(int, input().split()) ary = [] for i in range(n): ary.append(list(map(int, input()))) dx = [1, -1, 0, 0] dy = [0, 0, 1, -1] def bfs(x,y): q = deque() q.append((x,y)) while q: x, y = ..
https://www.acmicpc.net/problem/10815 10815번: 숫자 카드 첫째 줄에 상근이가 가지고 있는 숫자 카드의 개수 N(1 ≤ N ≤ 500,000)이 주어진다. 둘째 줄에는 숫자 카드에 적혀있는 정수가 주어진다. 숫자 카드에 적혀있는 수는 -10,000,000보다 크거나 같고, 10, www.acmicpc.net 내 풀이(맞음) def binary_search(array, target, start, end): mid = (start + end) // 2 if start > end: return None if target == array[mid]: return mid elif target < array[mid]: return binary_search(array, target, ..
https://programmers.co.kr/learn/courses/30/lessons/42626 코딩테스트 연습 - 더 맵게 매운 것을 좋아하는 Leo는 모든 음식의 스코빌 지수를 K 이상으로 만들고 싶습니다. 모든 음식의 스코빌 지수를 K 이상으로 만들기 위해 Leo는 스코빌 지수가 가장 낮은 두 개의 음식을 아래와 같 programmers.co.kr 내 풀이(질문 봄) import heapq def solution(scoville, K): answer = 0 scoville.sort() sum = 0 while scoville[0] < K: if len(scoville)
https://programmers.co.kr/learn/courses/30/lessons/42586 코딩테스트 연습 - 기능개발 프로그래머스 팀에서는 기능 개선 작업을 수행 중입니다. 각 기능은 진도가 100%일 때 서비스에 반영할 수 있습니다. 또, 각 기능의 개발속도는 모두 다르기 때문에 뒤에 있는 기능이 앞에 있는 programmers.co.kr 내 풀이(맞음) def solution(progresses, speeds): answer = [] while progresses: count = 0 for i in range(len(progresses)): if progresses[i] >= 100: continue progresses[i] += speeds[i] while progresses: if p..