Created
January 26, 2018 04:39
-
-
Save clarkdo/3837f6b30c89379e687762688007ede4 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
class Solution { | |
public int solution(int[] A) { | |
int sum = 0; | |
int sumA = 0; | |
for (int i = 0; i < A.length; i++) { | |
int digit = i + 1; | |
sum += digit; | |
sumA += A[i]; | |
} | |
return A.length + 1 - (sumA - sum); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment