Created
March 14, 2021 05:50
-
-
Save minhphong306/55cfcdd5f9fbee388be266ab7705fc36 to your computer and use it in GitHub Desktop.
sol3.go
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
func sol3(arr []int, n int) int { | |
sum := 0 | |
for i := 0; i < len(arr); i++ { | |
sum += arr[i] | |
} | |
return sum - n*(n-1)/2 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment