LeetCode

560. Subarray Sum Equals K

560. Subarray Sum Equals K 問題描述 給定一個整數陣列和一個整數 K,求子陣列總和等於 K

829. Consecutive Numbers Sum

829. Consecutive Numbers Sum 題目給定一個 n ,要求要找出總共存在著幾組連續整數,其總和為 n ,這一題是困難等級的題目,

1135. Connecting Cities With Minimum Cost

1135. Connecting Cities With Minimum Cost 這一題題目給的標籤是中等難度,不過應該算是偏向困難的中等題目,算是進階版的廣度優先搜索題目。 這一個題目我會建議先去想題目要問的是什麼,

344. Reverse String

344. Reverse String 這一題並不難,主要是熟悉用不同的方式來完成同樣的一件事情 雙指針 class Solution: def reverseString(

204. Count Primes

204. Count Primes 這個題目屬於數學題,題目要找的是小於 n 的數字中,有多少質數存在? 直覺的想法我們就遍歷所有的數字,並且一個一個檢查,

710. Random Pick with Blacklist

710. Random Pick with Blacklist class Solution: def __init__(self,

99. Recover Binary Search Tree

99. Recover Binary Search Tree # Definition for a binary tree

250. Count Univalue Subtrees

250. Count Univalue Subtrees # Definition for a binary tree node.

84. Largest Rectangle in Histogram

84. Largest Rectangle in Histogram 我一開始想的想法是雙指針的做法,那就是我一樣從左右往中間逼近,但是呢,逼近的過程中我先找出哪個高度最低,那這個高度就會決定了在目前左右寬的情況下,

426. Convert Binary Search Tree to Sorted Doubly Linked List

426. Convert Binary Search Tree to Sorted Doubly Linked List