LeetCode

1770. Maximum Score from Performing Multiplication Operations

1770. Maximum Score from Performing Multiplication Operations Top-Down class Solution:

740. Delete and Earn

740. Delete and Earn 這個題目從題目本身的敘述其實滿容易猜到解法是透過動態規劃求解,比較困難的是要找到符合動態規劃的子問題。 題目給的條件是如果選定一個數字 k,其中如果有 n

1137. N-th Tribonacci Number

1137. N-th Tribonacci Number 自頂向下 class Solution: def tribonacci(self,

746. Min Cost Climbing Stairs

746. Min Cost Climbing Stairs class Solution: def minCostClimbingStairs(self,

Kth Smallest Element in a Sorted Matrix

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

141. Linked List Cycle

141. Linked List Cycle # Definition for singly-linked list. # class ListNode:

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 來實作

707. Design Linked List

707. Design Linked List class ListNode: def __init__(self, x)