0%

Difficult:Medium

題目

You are given an integer array prices where prices[i] is the price of a given stock on the ith day.

On each day, you may decide to buy and/or sell the stock. You can only hold at most one share of the stock at any time. However, you can buy it then immediately sell it on the same day.

Find and return the maximum profit you can achieve.

閱讀全文 »

Difficult:Easy

題目

You are given an array prices where prices[i] is the price of a given stock on the ith day.

You want to maximize your profit by choosing a single day to buy one stock and choosing a different day in the future to sell that stock.

Return the maximum profit you can achieve from this transaction. If you cannot achieve any profit, return 0.

閱讀全文 »

Difficult:Medium

題目

Given a triangle array, return the minimum path sum from top to bottom.

For each step, you may move to an adjacent number of the row below. More formally, if you are on index i on the current row, you may move to either index i or index i + 1 on the next row.

閱讀全文 »

前言

Linked List(連結串列)是一種常見的資料結構,利用node節點來記錄、表示、儲存資料,且利用每個
node的next指向下一個node,以此來連接多個node,並以Null來代表linked List的終點。

閱讀全文 »