728x90 반응형 leetcode23 Leetcode 416. Partition Equal Subset Sum https://leetcode.com/problems/partition-equal-subset-sum/ Partition Equal Subset Sum - 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 이 문제는 처음에 만만하게 보고 간단한 코드를 짰다가 에러가 나서 애를 먹은 문제입니다 ㅜㅠ 여러 풀이를 보면서 어떤 식으로 해결 될 수 있는지 보겠습니다. Brute-Force class Solution: def canPartition(self, nums): d.. 2022. 10. 4. Leetcode 139. Word Break (Trie, BFS, DP) https://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 이전에 Trie의 개념과 기본 구조를 다루는 문제를 풀었었는데요 2022.09.27 - [Data Structure & Algorithm] - Trie (트라이, Digital tree, prefix, Retrieval tree) + 예제 코드 Trie (트라이, Digital tree, prefix, Retrieval.. 2022. 10. 3. Leetcode 75. Sort Colors (Dutch National flag, pointers) https://leetcode.com/problems/sort-colors/ Sort Colors - 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 이 문제는 sort 없이 0,1,2로 대표되는 빨강,하얀,파랑 3가지 색깔 순서대로 정렬시키는 문제입니다 다른 문제와 달리, return 없이 값을 교체해야 한다는 조건이 붙어있습니다 class Solution: def sortColors(self, nums: List[int]) -> None: colors = [0.. 2022. 10. 3. Leetcode 721. Accounts Merge (Union Find) https://leetcode.com/problems/accounts-merge/ Accounts Merge - 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 또 다시 만난 Union Find 문제,,,, 하지만 다시 헤매고 문제의 취지에 맞지 않게 풀이를 작성한 제 풀이를 보며 반성하는 마음으로,,,풀이를 분석해보겠습니다 class Solution: def accountsMerge(self, accounts: List[List[str]]) -> List[Lis.. 2022. 9. 30. Leetcode 56. Merge Intervals https://leetcode.com/problems/merge-intervals/ Merge Intervals - 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 merge(self, intervals): res = [] intervals.sort(key= lambda x: x[0]) if len(intervals) == 1: return intervals for i in range(len(intervals)-1):.. 2022. 9. 29. Leetcode 19. Remove Nth node from end of the list (Linked List, two-pointer) https://leetcode.com/problems/remove-nth-node-from-end-of-list/submissions/ Remove Nth Node From End of List - 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 처음 풀이) # Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # se.. 2022. 9. 28. 이전 1 2 3 4 다음 728x90 반응형