Skip to content

Instantly share code, notes, and snippets.

@clarkdo
Created January 26, 2018 04:39
Show Gist options
  • Save clarkdo/3837f6b30c89379e687762688007ede4 to your computer and use it in GitHub Desktop.
Save clarkdo/3837f6b30c89379e687762688007ede4 to your computer and use it in GitHub Desktop.
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