Problem
Java
Hash Set
1 | import java.util.HashSet; |
Submission Detail
- 61 / 61 test cases passed.
- Runtime: 8 ms, faster than 42.20% of Java online submissions for Single Number.
- Memory Usage: 39.8 MB, less than 22.36% of Java online submissions for Single Number.
sorting
1 | class Solution { |
Submission Detail
- 61 / 61 test cases passed.
- Runtime: 5 ms, faster than 54.05% of Java online submissions for Single Number.
- Memory Usage: 39.2 MB, less than 69.77% of Java online submissions for Single Number.
XOR Bitwise
n ^ n = 0
n ^ 0 = n
1 | class Solution { |
Submission Detail
- 61 / 61 test cases passed.
- Runtime: 1 ms, faster than 94.97% of Java online submissions for Single Number.
- Memory Usage: 39.1 MB, less than 79.60% of Java online submissions for Single Number.
java8 stream + xor bitwise
1 | class Solution { |
Submission Detail
- 61 / 61 test cases passed.
- Runtime: 2 ms, faster than 55.66% of Java online submissions for Single Number.
- Memory Usage: 39.2 MB, less than 69.77% of Java online submissions for Single Number.