Skip to content

Instantly share code, notes, and snippets.

@cg4jins
Created July 15, 2019 15:12
Show Gist options
  • Save cg4jins/d2728181d23e1e6d70bd6f00726815f5 to your computer and use it in GitHub Desktop.
Save cg4jins/d2728181d23e1e6d70bd6f00726815f5 to your computer and use it in GitHub Desktop.
class Solution {
fun solution(a: Int, b: Int): Long {
var answer = 0L
if (a == b){
return a.toLong()
}
var min = Integer.min(a,b)
var max = Integer.max(a,b)
for (i in min .. max){
answer += i
}
return answer
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment