diff --git a/.classpath b/.classpath
index fd1d061..f0257c5 100644
--- a/.classpath
+++ b/.classpath
@@ -13,11 +13,32 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/.project b/.project
index d8834ad..2ca9e82 100644
--- a/.project
+++ b/.project
@@ -20,4 +20,15 @@
org.eclipse.jdt.core.javanature
org.eclipse.m2e.core.maven2Nature
+
+
+ 1605433362927
+
+ 30
+
+ org.eclipse.core.resources.regexFilterMatcher
+ node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__
+
+
+
diff --git a/.settings/org.eclipse.jdt.apt.core.prefs b/.settings/org.eclipse.jdt.apt.core.prefs
new file mode 100644
index 0000000..d4313d4
--- /dev/null
+++ b/.settings/org.eclipse.jdt.apt.core.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.apt.aptEnabled=false
diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs
index db24ee7..ea7a397 100644
--- a/.settings/org.eclipse.jdt.core.prefs
+++ b/.settings/org.eclipse.jdt.core.prefs
@@ -11,5 +11,6 @@ org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
+org.eclipse.jdt.core.compiler.processAnnotations=disabled
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=1.8
diff --git a/README.md b/README.md
index b91375c..f3c7438 100644
--- a/README.md
+++ b/README.md
@@ -2,8 +2,8 @@
日常刷lintCode算法,提高自己的编码能力.
-- [字符串相关](./src/string)
-- [list相关](./src.list)
-- [简单算法](./src/simple)
-- [九章算法](./src/jiuzhang)
+- [字符串相关](./src/main/java/com/leetcode/string)
+- [list相关](./src/main/java/com/leetcode/list)
+- [简单算法](./src/main/java/com/leetcode/simple)
+- [九章算法](./src/main/java/com/leetcode/jiuizhang)
diff --git a/leetCode/ThreeSum.md b/leetCode/ThreeSum.md
deleted file mode 100644
index 178f197..0000000
--- a/leetCode/ThreeSum.md
+++ /dev/null
@@ -1,60 +0,0 @@
-## 题目描述
-
-给定一个包含 n 个整数的数组 nums,判断 nums 中是否存在三个元素 a,b,c ,使得 a + b + c = 0 ?找出所有满足条件且不重复的三元组。
-
-注意:答案中不可以包含重复的三元组。
-
-示例:
-
-给定数组 nums = [-1, 0, 1, 2, -1, -4],
-
-满足要求的三元组集合为:
-```
-[
- [-1, 0, 1],
- [-1, -1, 2]
-]
-```
-
-## 解题思路
-![2020-01-19_21-44.png](https://img.zeekling.cn/images/2020/01/19/2020-01-19_21-44.png)
-
-## 答案
-
-```java
-class Solution {
- public List> threeSum(int[] nums) {
- List> res = new ArrayList<>();
- Arrays.sort(nums);
- int min=0,mid=1, max=nums.length-1, s= 0;
- while(nums.length >= 3 && min < nums.length && nums[min] <= 0){
- mid = min + 1;
- max = nums.length-1;
- if(min > 0 && nums[min] == nums[min -1]){
- min ++;
- continue;
- }
- while(mid < max){
- s = nums[min] + nums[mid] + nums[max];
- if (s < 0){
- mid ++;
- }else if(s > 0){
- max --;
- }else if (s == 0){
- res.add(Arrays.asList(nums[min],nums[mid], nums[max]));
- while(mid < max && nums[mid] == nums[mid + 1]){
- mid ++;
- }
- while(mid< max && nums[max] == nums[max-1]){
- max --;
- }
- mid ++;
- max --;
- }
- }
- min++;
- }
- return res;
- }
-}
-```
diff --git a/src/main/java/com/leetcode/jiuzhang/PlusAB.java b/src/main/java/com/leetcode/jiuzhang/PlusAB.java
index c7d008b..8028279 100644
--- a/src/main/java/com/leetcode/jiuzhang/PlusAB.java
+++ b/src/main/java/com/leetcode/jiuzhang/PlusAB.java
@@ -18,7 +18,7 @@ public class PlusAB {
return a;
}
- public static void main(String[] args){
+ public static void main(String[] args) {
PlusAB ab = new PlusAB();
System.out.println(ab.plus(1,3));
}
diff --git a/src/main/java/com/leetcode/list/FindMedianSortedArrays.java b/src/main/java/com/leetcode/list/FindMedianSortedArrays.java
new file mode 100644
index 0000000..7ec579c
--- /dev/null
+++ b/src/main/java/com/leetcode/list/FindMedianSortedArrays.java
@@ -0,0 +1,70 @@
+package com.leetcode.list;
+
+import java.text.DecimalFormat;
+/**
+ *
+ *
+给定两个大小为 m 和 n 的正序(从小到大)数组 nums1 和 nums2。请你找出并返回这两个正序数组的中位数。
+进阶:你能设计一个时间复杂度为 O(log (m+n)) 的算法解决此问题吗?
+
+ 示例 1:
+
+输入:nums1 = [1,3], nums2 = [2]
+输出:2.00000
+解释:合并数组 = [1,2,3] ,中位数 2
+示例 2:
+
+输入:nums1 = [1,2], nums2 = [3,4]
+输出:2.50000
+解释:合并数组 = [1,2,3,4] ,中位数 (2 + 3) / 2 = 2.5
+示例 3:
+
+输入:nums1 = [0,0], nums2 = [0,0]
+输出:0.00000
+示例 4:
+
+输入:nums1 = [], nums2 = [1]
+输出:1.00000
+示例 5:
+
+输入:nums1 = [2], nums2 = []
+输出:2.00000
+题库位置:https://leetcode-cn.com/problems/median-of-two-sorted-arrays/
+
+ *
+ * @author zeekling
+ *
+ */
+public class FindMedianSortedArrays {
+
+ public double median(int[] nums1, int[] nums2) {
+ int all = nums1.length + nums2.length;
+ int mi = 0,ni = 0, curr = 0, pre = 0;
+ for ( int i = 0;i < all;i++ ) {
+ pre = curr;
+ if (mi < nums1.length && ni >= nums2.length ){
+ curr = nums1[mi++];
+ }else if (mi >= nums1.length && ni < nums2.length) {
+ curr = nums2[ni++];
+ }else {
+ curr = nums1[mi] < nums2[ni] ? nums1[mi++] : nums2[ni++];
+ }
+ if (i*2 == all ){
+ return ((double)curr + (double)pre)/2;
+ }
+ if ((i+1)*2 > all) {
+ return curr;
+ }
+ }
+ return 0;
+ }
+
+ public static void main(String[] args) {
+ FindMedianSortedArrays median = new FindMedianSortedArrays();
+ int[] nums1 = {2}, nums2 = {};
+ double res = median.median(nums1, nums2);
+ DecimalFormat format = new DecimalFormat("#.00000");
+ System.out.println(format.format(res));
+ }
+
+}
diff --git a/src/main/java/com/leetcode/list/PivotIndex.java b/src/main/java/com/leetcode/list/PivotIndex.java
index d60056b..e79e4af 100644
--- a/src/main/java/com/leetcode/list/PivotIndex.java
+++ b/src/main/java/com/leetcode/list/PivotIndex.java
@@ -17,9 +17,8 @@ public class PivotIndex {
for (int i=0; i< len;i++){
sum += nums[i];
}
- int idx = -1;
int leftSum = 0;
- for (int i=0;i 0 && (n += sumNums(n-1)) > 0;
+ @SuppressWarnings("unused")
+ boolean res = n > 0 && (n += sumNums(n-1)) > 0;
return n;
}