Skip to content

Commit

Permalink
commit
Browse files Browse the repository at this point in the history
  • Loading branch information
LighCNIT committed Mar 29, 2020
1 parent 65afcd2 commit 402b04e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 15 deletions.
11 changes: 6 additions & 5 deletions src/main/java/FindNumber.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,19 @@
*
* 输入: [4,1,2,1,2]
* 输出: 4
* @Author 李光华
* @Date 2019/10/9 17:46
* @Author 谢开心
* @Date 2020/01/11 11:07
**/
public class FindNumber {


/**
* @Description: 异或操作 n^0 = n; n^n = 0
* 时间复杂度 O(1) --- O(n)
* @param nums
* @return
* @author 李光华
* @date 2019/10/9 18:07
* @author 谢开心
* @date 2020/01/11 11:07
*/
public static int singleNumber(int[] nums) {
int target = 0;
Expand All @@ -34,7 +35,7 @@ public static int singleNumber(int[] nums) {
}

public static void main(String[] args) {
int[] nums = {4,1,2,1,2};
int[] nums = {6,1,2,1,2};
System.out.println(singleNumber(nums));
}
}
1 change: 0 additions & 1 deletion src/main/java/LeetCode50.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import com.google.common.collect.Maps;

import java.util.Map;

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/LongestSubstr.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public static void getMaxSubstr(String str){
for (char c : stringArr){
newArr.add(c);
}
newArr.stream().forEach(i-> System.out.println(i));
// newArr.stream().forEach(i-> System.out.println(i));
System.out.println(newArr.size());
}

Expand Down
8 changes: 0 additions & 8 deletions src/main/java/NumberSum.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import com.google.common.primitives.Ints;

import java.util.*;

Expand Down Expand Up @@ -75,12 +74,5 @@ public static void main(String[] args) {
int[] nums1 = twoSum(nums,22);
int[] nums2 = twoSum1(nums,9);
int[] nums3 = twoSum2(nums,9);

Ints.asList(nums1).forEach(i -> System.out.print(i+","));
System.out.println();
Ints.asList(nums2).forEach(e -> System.out.print(e+","));
System.out.println();
Ints.asList(nums3).forEach(e -> System.out.print(e+","));

}
}

0 comments on commit 402b04e

Please sign in to comment.