일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- 파이썬 프로그래머스
- 릿코드
- 파이썬릿코드풀기
- 파이썬 알고리즘
- 알고리즘풀이
- 파이썬알고리즘
- python priority queue
- LeetCode
- leetcode풀기
- python 릿코드
- 알고리즘풀기
- python Leetcode
- binary search
- 잇츠디모
- leetcode풀이
- python sorted
- leetcode 풀기
- 릿코드 풀기
- 파이썬 릿코드
- python zip_longest
- 릿코드 파이썬
- python xor
- 상가수익률계산기
- 파이썬릿코드
- 파이썬알고리즘풀기
- 파이썬 알고리즘 풀기
- 릿코드풀이
- 릿코드풀기
- python 알고리즘
- 코틀린기초
- Today
- Total
목록알고리즘/LeetCode (177)
소프트웨어에 대한 모든 것
532. K-diff Pairs in an Array https://leetcode.com/problems/k-diff-pairs-in-an-array/ K-diff Pairs in an Array - 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 문제) 솔루션1) 시간 복잡도 : O(n) class Solution: def findPairs(self, nums: List[int], k: int) -> int: counter = Counter(nums) res ..
258. Add Digits https://leetcode.com/problems/add-digits/ Add Digits - 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 문제) 솔루션1) Straight-forward class Solution: def addDigits(self, num: int) -> int: num_to_sumnum = lambda num: sum(int(n) for n in str(num)) while True: num = num_to..
454. 4Sum II https://leetcode.com/problems/4sum-ii/ 4Sum II - 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 문제) 솔루션1) brute-force O(n^4)으로 풀었더니 역시나 TLE(Time Limit Exceeded) 발생합니다. class Solution: def fourSumCount(self, nums1: List[int], nums2: List[int], nums3: List[int], nums4: ..
965. Univalued Binary Tree https://leetcode.com/problems/univalued-binary-tree/ Univalued Binary Tree - 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 문제) 솔루션1) Recursive # Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # s..
1022. Sum of Root To Leaf Binary Numbers https://leetcode.com/problems/sum-of-root-to-leaf-binary-numbers/ Sum of Root To Leaf Binary Numbers - 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 문제) 솔루션1) 재귀 # Definition for a binary tree node. # class TreeNode: # def __init__(self, v..
382. Linked List Random Node https://leetcode.com/problems/linked-list-random-node/ Linked List Random Node - 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 문제) 솔루션1) 리스트를 배열로 저장 시간복잡도 : O(1) 공간복잡도 : O(n) # Definition for singly-linked list. # class ListNode: # def __init__(self, ..
67. Add Binary https://leetcode.com/problems/add-binary/ Add Binary - 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 문제) 솔루션1) 직접 계산 class Solution: def addBinary(self, a: str, b: str) -> str: a = list(map(int, a)) b = list(map(int, b)) res = '' carry = 0 while a or b or carry: if..
1094. Car Pooling https://leetcode.com/problems/car-pooling/ Car Pooling - 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 문제) 솔루션1) class Solution(object): def carPooling(self, trips, capacity): """ :type trips: List[List[int]] :type capacity: int :rtype: bool """ d = defaultdict(..