일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- 개발자취업
- BFS
- 항해99
- 백준
- 개발자 취업
- 큐
- til
- 백준 2309
- 코딩테스트준비
- 기능개발
- easy 딥러닝
- 프로그래머스
- softeer
- 코딩테스트 준비
- BOJ
- 활성화 함수
- python 2309
- 스택
- 99항해
- dfs
- 해시
- leetcode
- Python
- 혁펜하임
- 파이썬
- 알고리즘
- 딥러닝
- 구현
- boj 2309
- 99클럽
- Today
- Total
목록til (58)
동까의 코딩
https://leetcode.com/problems/find-the-winner-of-the-circular-game/ class Node: def __init__(self, v): self.val = v self.next = None self.prev = Noneclass Solution: def findTheWinner(self, n: int, k: int) -> int: start_node = cur_node = Node(1) prev_node = None for i in range(2, n + 1): new_node = Node(i) cur_node.next = new_n..
https://leetcode.com/problems/reordered-power-of-2/description/ import itertoolsclass Solution: def reorderedPowerOf2(self, n: int) -> bool: cnt = 0 answer = False n = str(n) num_list = [] for i in n: num_list.append(i) nCr = itertools.permutations(num_list, len(num_list)) num_list = [] nCr = list(nCr) for i in range(le..
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