Created
January 21, 2020 18:32
-
-
Save isisnaomi/e1ea40516cfe9f448226d4743aeeb2cb 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
func simpleAddingGauss(_ number: Int) -> Int { | |
return (number * (1 + number)) / 2 | |
} | |
func simpleAddingNaive(_ number: Int) -> Int { | |
var sum = 0 | |
for i in 0...number { | |
sum = sum + i | |
} | |
return sum | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment