Skip to content

Instantly share code, notes, and snippets.

@kninami
Created October 27, 2016 07:15
Show Gist options
  • Save kninami/9635aa5700d47fcaa894427c68f0bdb3 to your computer and use it in GitHub Desktop.
Save kninami/9635aa5700d47fcaa894427c68f0bdb3 to your computer and use it in GitHub Desktop.
class Solution {
public int solution(int[] A) {
long N = A.length +1;
long totalSum = (N*(N+1))/2;
for(int i=0; i<A.length; i++){
totalSum -= A[i];
}
return (int)totalSum;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment