일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- leetcode
- python 2309
- 일곱 난쟁이
- 구현
- 백준 2309
- 백준
- 파이썬
- BFS
- 백준 카드1
- 스택
- leetcode 2405
- python 10989
- BOJ
- 항해99
- python 14503
- Python
- til
- Python 20001
- 개발자 취업
- python 10250
- 백준 막대기
- 백준 팰린드롬수
- 코딩테스트 준비
- 99항해
- boj 2309
- 99클럽
- 프로그래머스
- softeer
- 큐
- python 1259
- Today
- Total
목록문제 풀이 (63)
동까의 코딩
https://leetcode.com/problems/top-k-frequent-elements/submissions/1294689495/ 정렬하여 카운트를 해주고, 많은 숫자를 보여한 숫자를 정답칸에 K만큼 저장해주고 반환하는 문제입니다. class Solution: def topKFrequent(self, nums: List[int], k: int) -> List[int]: cnt = {} cnt_list = [[] for _ in range(len(nums) + 1)] answer = [] for num in nums: cnt[num] = 1 + cnt.get(num, 0) for key, val in cnt.i..
https://leetcode.com/problems/sort-characters-by-frequency/description/ class Solution: def frequencySort(self, s: str) -> str: m = {} for c in s: if c not in m: m[c] = 1 else: m[c] += 1 li = sorted([(m[i], i) for i in m], reverse=True) res = [] for count, c in li: res.append(c * count) ..
https://leetcode.com/problems/minimum-suffix-flips/submissions/1291875785/ 오늘의 문제는 leetcode의 문자열 문제입니다. class Solution: def minFlips(self, target: str) -> int: acc=0 for i in range(len(target)): if target[i]=="0" and acc%2==0 or target[i]=="1" and acc%2==1: continue else: acc+=1 return acc
https://leetcode.com/problems/iterator-for-combination/submissions/1291059479/ class CombinationIterator: def __init__(self, characters: str, combinationLength: int): self.len = len(characters) self.characters = characters self.pointers = [i for i in range(combinationLength)] self.pointers[-1] -= 1 self.thres = [i for i in range(self.len - len(self.pointers)..
https://leetcode.com/problems/group-the-people-given-the-group-size-they-belong-to/ class Solution: def groupThePeople(self, groupSizes: List[int]) -> List[List[int]]: rst, dt = [], collections.defaultdict(list) for i, g in enumerate(groupSizes): dt[g].append(i) if len(dt[g]) == g: rst.append(dt[g]) dt[g] = [] return rst
https://leetcode.com/problems/find-the-original-array-of-prefix-xor/submissions/1289234381/ leetcode 문제사이트의 배열 문제입니다. class Solution: def findArray(self, pref: List[int]) -> List[int]: ans = [0] * len(pref) ans[0] = pref[0] for i in range(1, len(ans)): ans[i] = pref[i] ^ pref[i - 1] return ans
https://leetcode.com/problems/subrectangle-queries/ class SubrectangleQueries: def __init__(self, rectangle: List[List[int]]): self.rectangle = rectangle def updateSubrectangle(self, row1: int, col1: int, row2: int, col2: int, newValue: int) -> None: for i in range(row1, row2 + 1) : for j in range(col1, col2 + 1) : self.rectangle[i][j] = new..
https://school.programmers.co.kr/learn/courses/30/lessons/49191 프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr def solution(n, results): answer = 0 board = [[0] * n for _ in range(n)] for a,b in results: board[a - 1][b - 1] = 1 board[b - 1][a - 1] = -1 for k in range(n): for i in range(n): ..