We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c86b201 commit b3dc2a0Copy full SHA for b3dc2a0
1 file changed
two-sum/dohyeon2.java
@@ -21,17 +21,12 @@ public int[] twoSum(int[] nums, int target) {
21
boolean indexExists = index != null;
22
boolean indexExistsAndIndexIsNotTheNum = indexExists && i != index;
23
if (indexExistsAndIndexIsNotTheNum) {
24
- // Manual sort
25
- if (i < index) {
26
- return new int[] { i, index };
27
- } else {
28
- return new int[] { index, i };
29
- }
+ return new int[] { i, index };
30
}
31
32
33
// If the valid answer is always exists this is not needed
34
// But the compiler don't know about that
35
return new int[2];
36
37
-}
+}
0 commit comments