일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- 파이썬 프로그래머스
- python 알고리즘
- python 릿코드
- python Leetcode
- 릿코드 풀기
- 파이썬 알고리즘 풀기
- LeetCode
- 릿코드풀이
- 알고리즘풀이
- 파이썬릿코드
- 알고리즘풀기
- 파이썬알고리즘풀기
- 릿코드풀기
- 상가수익률계산기
- 파이썬 알고리즘
- python xor
- 코틀린기초
- python zip_longest
- 릿코드
- python sorted
- 파이썬알고리즘
- leetcode풀기
- 파이썬릿코드풀기
- leetcode 풀기
- 릿코드 파이썬
- 파이썬 릿코드
- binary search
- leetcode풀이
- Today
- Total
목록알고리즘/LeetCode (177)
소프트웨어에 대한 모든 것
71. Simplify Path https://leetcode.com/problems/simplify-path/ Simplify Path - 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 simplifyPath(self, path: str) -> str: # any multiple consecutive slashes (i.e. '//') are treated as a single slash '/' path =..
2. Add Two Numbers https://leetcode.com/problems/add-two-numbers/ Add Two 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) bruto-force 풀이 순서: 1) 리스트를 array 자료구조로 변환 2) carry를 계산하면서 각 자리수 add 3) 최종 결과물 array를 리스트로 변환해서 리턴 # Definition for singly-linked list. # cla..
2120. Execution of All Suffix Instructions Staying in a Grid https://leetcode.com/problems/execution-of-all-suffix-instructions-staying-in-a-grid/ Execution of All Suffix Instructions Staying in a Grid - 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 시간복잡도 : ..
413. Arithmetic Slices https://leetcode.com/problems/arithmetic-slices/ Arithmetic Slices - 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 numberOfArithmeticSlices(self, nums: List[int]) -> int: """ Time Complexity : O(N^2) Space Complexity : O(1) """..
47. Permutations II https://leetcode.com/problems/permutations-ii/ Permutations 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) 백트래킹 백트래킹 방식으로 순열을 한땀 한땀 구현합니다. class Solution: def permuteUnique(self, nums: List[int]) -> List[List[int]]: res = [] def recur(cur, remain..
2181. Merge Nodes in Between Zeros https://leetcode.com/problems/merge-nodes-in-between-zeros/ 문제) 솔루션1) # Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution: def mergeNodes(self, head): cur = head.next cur_sum = 0 res = [] while cur: if cur.val == 0: res.append(cur_sum) cur_sum = 0 else: cur_sum += cur...
287. Find the Duplicate Number https://leetcode.com/problems/find-the-duplicate-number/ Find the Duplicate Number - 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 findDuplicate(self, nums): nums = sorted(nums) for i in r..
34. Find First and Last Position of Element in Sorted Array https://leetcode.com/problems/find-first-and-last-position-of-element-in-sorted-array/ 문제) 솔루션1) binary search 풀이 순서: 1) 바이너리 서치로 target을 탐색 2) 찾은 target에서 왼쪽으로 인덱스를 이동하면서 동일한 target 값이 나올 때 까지 이동 (left idx) 3) 찾은 target에서 오른쪽 인덱스를 이동하면서 동일한 target 값이 나올 때 까지 이동 (right idx) 위 풀이는 결국 시간 복잡도 O(n)을 갖기 때문에 O(logn)을 만족하지 못 합니다. class Solutio..