Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 6464e4f

Browse files
refactor for format
1 parent d32b2c5 commit 6464e4f

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ public class _11 {
1010
public int maxArea(int[] height) {
1111
int max = Integer.MIN_VALUE;
1212
int len = height.length;
13-
int i = 0, j = len - 1;
13+
int i = 0;
14+
int j = len - 1;
1415
while (i < j) {
1516
if (Math.min(height[i], height[j]) * (j - i) > max) {
1617
max = Math.min(height[i], height[j]) * (j - i);

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ public class _115 {
1111
* 4. starting from (1,1)*/
1212

1313
public int numDistinct(String s, String t) {
14-
int m = s.length(), n = t.length();
14+
int m = s.length();
15+
int n = t.length();
1516
int[][] dp = new int[m + 1][n + 1];
1617

1718
char[] schar = s.toCharArray();

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

+4-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@ public class _123 {
1313
//this is a very clear solution and very highly upvoted in Discuss, but not extensibel to K solution.
1414
public int maxProfit(int[] prices) {
1515
if (prices.length < 2) return 0;
16-
int buy1 = Integer.MIN_VALUE, buy2 = Integer.MIN_VALUE;//we use negative numbers to denote buy1 and buy2, thus use Integer.MIN_VALUE here is more convenient.
17-
int sell1 = 0, sell2 = 0;
16+
int buy1 = Integer.MIN_VALUE;
17+
int buy2 = Integer.MIN_VALUE;//we use negative numbers to denote buy1 and buy2, thus use Integer.MIN_VALUE here is more convenient.
18+
int sell1 = 0;
19+
int sell2 = 0;
1820
for (int i = 0; i < prices.length; i++) {
1921
buy1 = Math.max(buy1, -prices[i]);
2022
sell1 = Math.max(sell1, buy1 + prices[i]);

0 commit comments

Comments
 (0)