Skip to content

Commit b6fd947

Browse files
edit 1
1 parent b723e86 commit b6fd947

File tree

2 files changed

+2
-16
lines changed

2 files changed

+2
-16
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,7 @@ Your ideas/fixes/algorithms are more than welcome!
591591
|4|[Median of Two Sorted Arrays](https://leetcode.com/problems/median-of-two-sorted-arrays/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_4.java) | ? | ? | Hard | Divide and Conquer
592592
|3|[Longest Substring Without Repeating Characters](https://leetcode.com/problems/longest-substring-without-repeating-characters/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_3.java) | O(n) | O(1) | Medium | HashMap, Sliding Window
593593
|2|[Add Two Numbers](https://leetcode.com/problems/add-two-numbers/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_2.java) | O(max(m,n)) | O(1) | Medium | LinkedList
594-
|1|[Two Sum](https://leetcode.com/problems/two-sum/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1.java)| O(n)/O(n^2)|O(1)/O(n) | Easy| HashMap
594+
|1|[Two Sum](https://leetcode.com/problems/two-sum/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1.java)| O(n)| O(n) | Easy| HashMap
595595

596596
## Database
597597

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

+1-15
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919
public class _1 {
2020

21-
public int[] twoSum_ON(int[] nums, int target) {
21+
public int[] twoSum(int[] nums, int target) {
2222
Map<Integer, Integer> map = new HashMap();
2323
int[] result = new int[2];
2424
for(int i = 0; i < nums.length; i++){
@@ -33,18 +33,4 @@ public int[] twoSum_ON(int[] nums, int target) {
3333
return result;
3434
}
3535

36-
public int[] twoSum_ON2(int[] nums, int target) {
37-
int[] result = new int[2];
38-
for(int i = 0; i < nums.length-1; i++){
39-
for(int j = i+1; j < nums.length; j++){
40-
if(nums[i] + nums[j] == target){
41-
result[0] = i;
42-
result[1] = j;
43-
break;
44-
}
45-
}
46-
}
47-
return result;
48-
}
49-
5036
}

0 commit comments

Comments
 (0)