Skip to content

Instantly share code, notes, and snippets.

@AppleCEO
Created December 27, 2019 10:41
Show Gist options
  • Save AppleCEO/63afbdd151835c0d86c2ae295c03673e to your computer and use it in GitHub Desktop.
Save AppleCEO/63afbdd151835c0d86c2ae295c03673e to your computer and use it in GitHub Desktop.
import Foundation
func solution(_ a:Int, _ b:Int) -> Int64 {
var result = 0
let max: Int
let min: Int
if a > b {
max = a
min = b
} else {
max = b
min = a
}
for number in min...max {
result += number
}
return Int64(result)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment