Created
June 21, 2018 03:54
-
-
Save basekays/65aaa283a68ee6a9aa945c0ae7066e44 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var missingNumber = function(nums) { | |
| let sum = 0; | |
| let expectedSum = nums.length; | |
| for (var i = 0; i < nums.length; i++) { | |
| sum += nums[i]; | |
| expectedSum += i; | |
| } | |
| return expectedSum - sum; | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment