Created
October 27, 2016 07:15
-
-
Save kninami/9635aa5700d47fcaa894427c68f0bdb3 to your computer and use it in GitHub Desktop.
This file contains 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) { | |
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