Created
September 7, 2020 16:08
-
-
Save bky373/6cb88bb4a70b32efea8d04252ddc024f to your computer and use it in GitHub Desktop.
This file contains hidden or 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
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