Skip to content

Instantly share code, notes, and snippets.

@bky373
Created September 7, 2020 16:08
Show Gist options
  • Save bky373/6cb88bb4a70b32efea8d04252ddc024f to your computer and use it in GitHub Desktop.
Save bky373/6cb88bb4a70b32efea8d04252ddc024f to your computer and use it in GitHub Desktop.
class Solution {
fun solution(a: Int, b: Int): Long {
if(a == b) return b.toLong()
val list = listOf(a, b).sorted()
return (list[0]..list[1]).map { it.toLong() }.sum()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment