Heap

480. Sliding Window Median

480. Sliding Window Median 這個題目是一個移動窗口以及找尋中位數的題目,難度為 hard ,這個題目難的地方在於: 1. 每次移動窗口的時候,

1962. Remove Stones to Minimize the Total

1962. Remove Stones to Minimize the Total class Solution: def

870. Advantage Shuffle

870. Advantage Shuffle class Solution: def advantageCount(self, nums1: List[

Meta - Kaitenzushi

from typing import List # Write any import statements here import

933. Number of Recent Calls

933. Number of Recent Calls 這個題目可以利用 min heap 可以保持排序的方式來檢查,只要

Kth Smallest Element in a Sorted Matrix

378. Kth Smallest Element in a Sorted Matrix 題目的要求是找到在一個排序好的組合矩陣中,找到第

1046. Last Stone Weight

1046. Last Stone Weight class Solution: def lastStoneWeight(self, stones:

703. Kth Largest Element in a Stream

703. Kth Largest Element in a Stream class KthLargest: def

215. Kth Largest Element in an Array

215. Kth Largest Element in an Array 需要透過 heap 來實作

295. Find Median from Data Stream

295. Find Median from Data Stream 這題如果透過排序的話,就會很好做,在每次取出數值時,將記憶體中的每個數字排列好,