You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -901,11 +901,11 @@ You can also ask for problem solving ideas and discuss in GitHub issues directly
901
901
|104|[Maximum Depth of Binary Tree](https://leetcode.com/problems/maximum-depth-of-binary-tree/description/)|[Java](https://github.com/guobinhit/myleetcode/blob/master/codes/java/leetcodes/src/main/java/com/hit/basmath/learn/binary_tree/_104.java) & Python |Easy| Trees
902
902
|108|[Convert Sorted Array to Binary Search Tree](https://leetcode.com/problems/convert-sorted-array-to-binary-search-tree/description/)|[Java](https://github.com/guobinhit/myleetcode/blob/master/codes/java/leetcodes/src/main/java/com/hit/basmath/learn/binary_search_tree/_108.java) & Python |Easy| Trees
|121|[Best Time to Buy and Sell Stock](https://leetcode.com/problems/best-time-to-buy-and-sell-stock/description/)|[Java](https://github.com/guobinhit/myleetcode/blob/master/codes/java/leetcodes/src/main/java/com/hit/basmath/interview/top_interview_questions/easy_collection/dynamic_programming/_121.java) & Python |Easy| Dynamic Programming
905
-
|122|[Remove Duplicates from Sorted Array](https://leetcode.com/problems/remove-duplicates-from-sorted-array/description/)|[Java](https://github.com/guobinhit/myleetcode/blob/master/codes/java/leetcodes/src/main/java/com/hit/basmath/interview/top_interview_questions/easy_collection/array/_122.java) & Python|Easy| Array
904
+
|121|[Best Time to Buy and Sell Stock](https://leetcode.com/problems/best-time-to-buy-and-sell-stock/description/)|[Java](https://github.com/guobinhit/myleetcode/blob/master/codes/java/leetcodes/src/main/java/com/hit/basmath/interview/top_interview_questions/easy_collection/dynamic_programming/_121.java) & [Go](../master/codes/go/leetcodes/interview/easy_collection/121.go) |Easy| Dynamic Programming
905
+
|122|[Best Time to Buy and Sell Stock II](https://leetcode.com/problems/best-time-to-buy-and-sell-stock-ii)|[Java](https://github.com/guobinhit/myleetcode/blob/master/codes/java/leetcodes/src/main/java/com/hit/basmath/interview/top_interview_questions/easy_collection/array/_122.java) & Python|Easy| Array
|141|[Linked List Cycle](https://leetcode.com/problems/number-of-islands/description/)|[Java](https://github.com/guobinhit/myleetcode/blob/master/codes/java/leetcodes/src/main/java/com/hit/basmath/learn/linked_list/_141.java) & Python|Easy| Linked List
|141|[Linked List Cycle](https://leetcode.com/problems/linked-list-cycle/)|[Java](https://github.com/guobinhit/myleetcode/blob/master/codes/java/leetcodes/src/main/java/com/hit/basmath/learn/linked_list/_141.java) & [Go](../master/codes/go/leetcodes/interview/easy_collection/141.go)|Easy| Linked List
* Say you have an array for which the ith element is the price of a given stock on day i.
9
+
* <p>
10
+
* If you were only permitted to complete at most one transaction (i.e., buy one and sell one share of the stock), design an algorithm to find the maximum profit.
11
+
* <p>
12
+
* Note that you cannot sell a stock before you buy one.
13
+
* <p>
14
+
* Example 1:
15
+
* <p>
16
+
* Input: [7,1,5,3,6,4]
17
+
* Output: 5
18
+
* <p>
19
+
* Explanation: Buy on day 2 (price = 1) and sell on day 5 (price = 6), profit = 6-1 = 5.
20
+
* Not 7-1 = 6, as selling price needs to be larger than buying price.
21
+
* <p>
22
+
* Example 2:
23
+
* <p>
24
+
* Input: [7,6,4,3,1]
25
+
* Output: 0
26
+
* <p>
27
+
* Explanation: In this case, no transaction is done, i.e. max profit = 0.
0 commit comments