Skip to content

Commit ff836a6

Browse files
committed
Updated best time stock 3
1 parent b432a9c commit ff836a6

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Medium/BestTimeStock3.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,17 @@
1313
*/
1414
class BestTimeStock3 {
1515
public static void main(String[] args) {
16+
BestTimeStock3 b = new BestTimeStock3();
1617
int[] prices = { 6, 1, 3, 2, 4, 7, 6, 10, 15 };
17-
System.out.println(maxProfit(prices));
18+
System.out.println(b.maxProfit(prices));
1819
}
1920

2021
/**
2122
* Goes forward to build single transaction max profit
2223
* Then goes backward to build max since day i profit
2324
* Find the max of the sum of these two
2425
*/
25-
public static int maxProfit(int[] prices) {
26+
public int maxProfit(int[] prices) {
2627
int maxProfit = 0;
2728
if (prices == null || prices.length < 2) return maxProfit;
2829
int len = prices.length;

0 commit comments

Comments
 (0)