Skip to content

C/C++

LeetCode: 121-Best Time to Buy and Sell Stock 解題紀錄

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.
Read More »LeetCode: 121-Best Time to Buy and Sell Stock 解題紀錄

[C 語言] 陣列 (Arrays)

陣列(Array)是一種資料儲存的格式,在硬體中以連續記憶體空間來儲存資料;也就是說,每個元素之間的記憶體位置是相鄰的。

而在 C 語言當中,我們可以宣告一個變數代表整個陣列。例如 X[10] 這樣的型態便代表著有 10 筆資料儲存在 X 陣列當中,編號則是從 0 到 9。

Read More »[C 語言] 陣列 (Arrays)
Exit mobile version