Skip to content

Commit 27a631d

Browse files
refactor 122
1 parent 4c79859 commit 27a631d

File tree

2 files changed

+16
-18
lines changed

2 files changed

+16
-18
lines changed

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
public class _122 {
1313
public static class Solution1 {
14-
//peak and valley appraoch
14+
//peak and valley approach
1515
public int maxProfit(int[] prices) {
1616
int pro = 0;
1717
int i = 0;
@@ -42,5 +42,4 @@ public int maxProfit(int[] prices) {
4242
return pro;
4343
}
4444
}
45-
4645
}

src/test/java/com/fishercoder/_122Test.java

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,20 @@
77
import static junit.framework.Assert.assertEquals;
88

99
public class _122Test {
10-
private static _122.Solution1 solution1;
11-
private static _122.Solution2 solution2;
12-
private static int[] prices;
10+
private static _122.Solution1 solution1;
11+
private static _122.Solution2 solution2;
12+
private static int[] prices;
1313

14-
@BeforeClass
15-
public static void setup() {
16-
solution1 = new _122.Solution1();
17-
solution2 = new _122.Solution2();
18-
}
14+
@BeforeClass
15+
public static void setup() {
16+
solution1 = new _122.Solution1();
17+
solution2 = new _122.Solution2();
18+
}
1919

20-
@Test
21-
public void test1() {
22-
prices = new int[]{1, 2, 4};
23-
assertEquals(3, solution1.maxProfit(prices));
24-
assertEquals(3, solution2.maxProfit(prices));
25-
}
26-
27-
}
20+
@Test
21+
public void test1() {
22+
prices = new int[] {1, 2, 4};
23+
assertEquals(3, solution1.maxProfit(prices));
24+
assertEquals(3, solution2.maxProfit(prices));
25+
}
26+
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy