Skip to content

Commit cee23e0

Browse files
committed
tree
1 parent 3618d28 commit cee23e0

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package com.algorithm.bytype.sort;
2+
3+
/**
4+
* @author shenli
5+
* @date 2021/11/25
6+
*/
7+
public class Solution {
8+
public int solution(int[] A) {
9+
10+
int min = Integer.MAX_VALUE;
11+
12+
for (int p = 1; p < A.length - 2; p++) {
13+
for (int q = p + 2; q < A.length - 1; q++) {
14+
if (A[p] + A[q] < min) {
15+
min = A[p] + A[q];
16+
}
17+
}
18+
19+
}
20+
return min;
21+
}
22+
23+
public static void main(String[] args) {
24+
int[] A = new int[]{5, 2, 4, 6, 3, 1, 7};
25+
Solution solution = new Solution();
26+
System.out.print(solution.solution(A));
27+
}
28+
29+
}

src/main/java/com/algorithm/leetcode/tree/easy/FindMode.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import com.algorithm.leetcode.tree.TreeNode;
44

55
import java.util.ArrayList;
6+
import java.util.HashMap;
67
import java.util.List;
78

89
/**
@@ -55,4 +56,13 @@ public void update(int x) {
5556
res.add(base);
5657
}
5758
}
59+
60+
public static void main(String[] args) {
61+
HashMap <Character,Integer> map = new HashMap<>();
62+
String s = "456";
63+
char d1 = 'c';
64+
char d2= 'c';
65+
System.out.println(d1==d2);
66+
System.out.println(Integer.parseInt(s.substring(0,3)));
67+
}
5868
}

0 commit comments

Comments
 (0)