일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- Greedy
- dfs
- Stack
- GenerativeAI
- codeup
- nlp
- 리트코드
- array
- Python
- 슬라이딩윈도우
- 파이썬알고리즘
- gcp
- heap
- 릿코드
- two-pointer
- 알고리즘
- Python3
- SQL
- 생성형AI
- 투포인터
- 니트코드
- stratascratch
- LeetCode
- 자연어처리
- 파이썬기초100제
- GenAI
- sql코테
- 파이썬
- slidingwindow
- 코드업
- Today
- Total
목록2025/07 (8)
Tech for good

# Definition for singly-linked list.# class ListNode:# def __init__(self, val=0, next=None):# self.val = val# self.next = nextclass Solution: def frequenciesOfElements(self, head: Optional[ListNode]) -> Optional[ListNode]: values = [] curr = head while curr: values.append(curr.val) curr = curr.next freq = Counter(values) ..

Solution 1: prev + curr# Definition for singly-linked list.# class ListNode:# def __init__(self, val=0, next=None):# self.val = val# self.next = nextclass Solution: def deleteDuplicates(self, head: Optional[ListNode]) -> Optional[ListNode]: prev = head curr = None if head: curr = head.next while curr: if curr.val ==..

# Definition for singly-linked list.# class ListNode:# def __init__(self, val=0, next=None):# self.val = val# self.next = nextclass Solution: def reorderList(self, head: Optional[ListNode]) -> None: """ Do not return anything, modify head in-place instead. """ # 1. Find the middle of the list (slow & fast pointer) slow = head ..

Solution 1. By using length of head (one pass)# Definition for singly-linked list.# class ListNode:# def __init__(self, val=0, next=None):# self.val = val# self.next = nextclass Solution: def removeNthFromEnd(self, head: Optional[ListNode], n: int) -> Optional[ListNode]: # Step 1: Calculate the total length length = 0 curr = head while curr: ..

1. General while loop & for loop# Definition for singly-linked list.# class ListNode:# def __init__(self, val=0, next=None):# self.val = val# self.next = nextclass Solution: def middleNode(self, head: Optional[ListNode]) -> Optional[ListNode]: length = 0 curr = head while curr: curr = curr.next length += 1 mid = length // 2..

# Definition for singly-linked list.# class ListNode:# def __init__(self, x):# self.val = x# self.next = Noneclass Solution: def getIntersectionNode(self, headA: ListNode, headB: ListNode) -> Optional[ListNode]: passed_a = set() current_a = headA current_b = headB while current_a or current_b: if (current_a == current_b) and (current_a and curre..

# Definition for singly-linked list.# class ListNode:# def __init__(self, val=0, next=None):# self.val = val# self.next = nextclass Solution: def hasCycle(self, head: Optional[ListNode]) -> bool: passed = set() current = head while current: if current in passed: return True passed.add(current) current =..

https://neetcode.io/problems/anagram-groups NeetCode neetcode.io class Solution: def groupAnagrams(self, strs: List[str]) -> List[List[str]]: res = {} for word in strs: count = [0] * 26 for w in word: count[ord(w) - ord('a')] += 1 key = tuple(count) # print(key) if key in res: res[key].append(wo..