반응형 분류 전체보기128 [DSA][Heap] 07. Find Median from Data Stream LeetCode 295 07. Find Median from Data StreamThe median is the middle value in an ordered integer list.If the size of the list is even, there is no middle value, and the median is the mean of the two middle values.For example, for arr = [2,3,4], the median is 3.For example, for arr = [2,3], the median is (2 + 3) / 2 = 2.5.Implement the MedianFinder class:- MedianFinder() initializes the MedianFi.. 2025. 8. 26. [DSA][Heap] 06. Design Twitter LeetCode 355 06. Design TwitterDesign a simplified version of Twitter where users can post tweets, follow/unfollow another user, and is able to see the 10 most recent tweets in the user's news feed.Implement the Twitter class:- Twitter() Initializes your twitter object.- void postTweet(int userId, int tweetId) Composes a new tweet with ID tweetId by the user userId. Each call to this function wi.. 2025. 8. 25. [DSA][Heap] 05. Task Scheduler LeetCode 621 05. Task SchedulerYou are given an array of CPU tasks, each labeled with a letter from A to Z, and a number n.Each CPU interval can be idle or allow the completion of one task.Tasks can be completed in any order, but there's a constraint: there has to be a gap of at least n intervals between two tasks with the same label.Return the minimum number of CPU intervals required to complet.. 2025. 8. 20. [DSA][Heap] 04. Kth Largest Element in an Array LeetCode 215 04. Kth Largest Element in an ArrayGiven an integer array nums and an integer k, return the kth largest element in the array.Note that it is the kth largest element in the sorted order, not the kth distinct element.Can you solve it without sorting? [질문하기]- nums 배열의 길이는 항상 k 이상인가요? YES [풀이 1] Min Heapclass Solution: def findKthLargest(self, nums: List[int], k: int) -> int: .. 2025. 8. 16. 이전 1 ··· 4 5 6 7 8 9 10 ··· 32 다음