Skip to content

Instantly share code, notes, and snippets.

@AppleCEO
Created December 27, 2019 10:41
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