Skip to content

Commit ba36c6c

Browse files
dohee789dohee789
authored andcommitted
💬 modify line breaks
1 parent f6ef448 commit ba36c6c

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

contains-duplicate/dohee789.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@
44
class Solution {
55
public boolean containsDuplicate(int[] nums) {
66
Set<Integer> set = new HashSet();
7+
78
for(int n: nums){
89
if(set.contains(n)){
910
return true;
1011
}
1112
set.add(n);
1213
}
14+
1315
return false;
1416
}
1517
}

two-sum/dohee789.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,18 @@
44
class Solution {
55
public int[] twoSum(int[] nums, int target) {
66
Map<Integer, Integer> map = new HashMap<>();
7-
for(int i = 0; i < nums.length; i++){
7+
8+
for(int i = 0; i < nums.length; i++) {
89
map.put(nums[i], i);
910
}
1011

11-
for(int i = 0; i < nums.length; i++){
12-
if(map.containsKey(target - nums[i])
13-
&& map.get(target - nums[i]) != i){
12+
for(int i = 0; i < nums.length; i++) {
13+
if(map.containsKey(target - nums[i]) && map.get(target - nums[i]) != i) {
1414
int j = map.get(target - nums[i]);
1515
return new int[]{i, j};
1616
}
1717
}
18+
1819
return null;
1920
}
2021
}

0 commit comments

Comments
 (0)