Skip to content

Commit 256fbbf

Browse files
committed
Runtime 70 ms (Top 73.37%) | Memory 44.0 MB (Top 31.37%)
1 parent a91ffb5 commit 256fbbf

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
1-
// Runtime: 90 ms (Top 77.79%) | Memory: 44.2 MB (Top 70.06%)
21
var missingNumber = function(nums) {
3-
// Initialize res as zero...
4-
let res = 0;
5-
// Traverse all the element through the loop...
6-
for (let i = 0; i < nums.length; ++i) {
7-
// Calculation process by helping of Bit Manipulation...
8-
res ^= nums[i] ^ (i + 1);
9-
}
10-
return res; // Return the result
2+
return ((1 + nums.length)*nums.length/2) - nums.reduce((a,b) => a+b)
113
};

0 commit comments

Comments
 (0)