일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- 99항해
- til
- BFS
- 스택
- 개발자취업
- 프로그래머스
- 코딩테스트준비
- 개발자 취업
- 99클럽
- 큐
- 기능개발
- 해시
- 구현
- easy 딥러닝
- boj 2309
- 혁펜하임
- BOJ
- 백준 2309
- 활성화 함수
- leetcode
- dfs
- softeer
- 항해99
- 백준
- 딥러닝
- 파이썬
- 코딩테스트 준비
- 알고리즘
- Python
- python 2309
- Today
- Total
목록문제 풀이 (92)
동까의 코딩
https://leetcode.com/problems/count-square-submatrices-with-all-ones/submissions/1282783267/ class Solution(object): def countSquares(self, matrix): if len(matrix) == 0 or len(matrix[0]) == 0: return 0 rows, cols = len(matrix), len(matrix[0]) dp = [[0 for _ in range(cols)] for _ in range(rows)] ans = 0 for i in range(rows): ..
leetcode 문제를 풀어 보았습니다. https://leetcode.com/problems/partition-array-for-maximum-sum/description/ class Solution: def maxSumAfterPartitioning(self, arr: List[int], k: int) -> int: n = len(arr) dp = [0] * (n + 1) for i in range(1, n + 1): max_val = float('-inf') for j in range(1, min(i, k) + 1): max_val = max(max_val, arr[i - j]) ..
https://leetcode.com/problems/count-sorted-vowel-strings/submissions/1280576421/ class Solution: f = {} def countVowelStrings(self, n): return self.nHr(5, n) def nHr(self, n, r): return self.fact(n+r-1) // self.fact(n-1) // self.fact(r) def fact(self, n): if n
https://leetcode.com/problems/all-possible-full-binary-trees/submissions/1279496386/ class Solution: def allPossibleFBT(self, n: int) -> List[Optional[TreeNode]]: dp = {} dp[1] = [TreeNode(0)] def dfs(cnt): ans = [] if cnt in dp: return dp[cnt] for i in range(1, cnt, 2): left_trees = dfs(i) righ..
https://school.programmers.co.kr/learn/courses/30/lessons/42885 프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr 그리디 문제를 오늘의 문제로 풀어보았습니다. sorted를 reverse를 해줘서 최대값과 최솟값의 합이 limit를 넘지 않으면 빼주는 방식을 사용한다. from collections import dequedef solution(people, limit): answer = 0 queue = deque(sorted(people, reverse=True)) while len(queue)..
오늘의 문제는 그리디 문제가 나왔습니다. 그리디에 대해 개념을 찾아보고 문제를 풀이하였고, 아직 제대로 설명할정도로 이해하진 못해서 다시 공부할 예정입니다. https://school.programmers.co.kr/learn/courses/30/lessons/42860 프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr def solution(name): answer = 0 min_move = len(name) - 1 for i, char in enumerate(name): answer += min(ord(char) - ord..
Leetcode에서 그래프 문제를 풀어보았습니다. https://leetcode.com/problems/reverse-odd-levels-of-binary-tree/description/ class Solution: def reverseOddLevels(self, root: Optional[TreeNode]) -> Optional[TreeNode]: nodes = [] level = [root] level_idx = 0 while level: if level_idx % 2 == 0: nodes.append(level) else: nodes.append(le..
leetcode에서 그래프문제를 풀어보았습니다. 아직도 leetcode 문제풀이는 너무 어렵습니다.. https://leetcode.com/problems/all-paths-from-source-to-target/description/ class Solution: def __init__(self): self.paths = [] self.graph = {} def buildGraph(self, graph): for i, neighbors in enumerate(graph): self.graph[i] = neighbors def setPaths(self, src, dest, path): if src == d..