코딩테스트 (4) 썸네일형 리스트형 139. Word Break 풀이 leetcode.com/problems/word-break/ Word Break - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com class Solution: def wordBreak(self, s: str, wordDict: List[str]) -> bool: if not s or not wordDict : return False words = set(wordDict) n = len(s) dp = [False]*(n+1) dp[0] = True for end .. 207. Course Schedule leetcode.com/problems/course-schedule/ Course Schedule - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com import collections class Solution: def canFinish(self, numCourses: int, prerequisites: List[List[int]]) -> bool: indegrees = [0]*numCourses graph = defaultdict(list) for u, v in.. 41. First Missing Positive leetcode.com/problems/first-missing-positive/ First Missing Positive - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com class Solution: def firstMissingPositive(self, nums: List[int]) -> int: if 1 not in nums : return 1 n = len(nums) for i in range(n) : if nums[i] n : nums[i] = 1 fo.. 835. Image Overlap leetcode.com/problems/image-overlap/ Image Overlap - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com class Solution: def largestOverlap(self, A: List[List[int]], B: List[List[int]]) -> int: posa = [] posb = [] for i in range(len(A)) : for j in range(len(A[0])) : if A[i][j] == 1 : p.. 이전 1 다음