Skip to content

Commit 81f5f80

Browse files
refactor 121
1 parent a0de094 commit 81f5f80

File tree

1 file changed

+0
-21
lines changed
  • src/main/java/com/fishercoder/solutions

1 file changed

+0
-21
lines changed

src/main/java/com/fishercoder/solutions/_121.java

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,5 @@
11
package com.fishercoder.solutions;
22

3-
/**
4-
* 121. Best Time to Buy and Sell Stock
5-
*
6-
* Say you have an array for which the ith element is the price of a given stock on day i.
7-
*
8-
* If you were only permitted to complete at most one transaction (ie, buy one and sell one share of the stock),
9-
* design an algorithm to find the maximum profit.
10-
*
11-
* Example 1:
12-
* Input: [7, 1, 5, 3, 6, 4]
13-
* Output: 5
14-
*
15-
* max. difference = 6-1 = 5 (not 7-1 = 6, as selling price needs to be larger than buying price)
16-
*
17-
* Example 2:
18-
* Input: [7, 6, 4, 3, 1]
19-
* Output: 0
20-
*
21-
* In this case, no transaction is done, i.e. max profit = 0.
22-
*/
23-
243
public class _121 {
254

265
public static class Solution1 {

0 commit comments

Comments
 (0)