mirror of
https://gitlab.com/mfocko/LeetCode.git
synced 2024-11-14 09:59:41 +01:00
9 lines
275 B
Kotlin
9 lines
275 B
Kotlin
|
class Solution {
|
||
|
fun minTimeToVisitAllPoints(points: Array<IntArray>): Int =
|
||
|
points.zip(points.drop(1)).sumOf { (a, b) ->
|
||
|
val (ax, ay) = a
|
||
|
val (bx, by) = b
|
||
|
Math.max((ax - bx).absoluteValue, (ay - by).absoluteValue)
|
||
|
}
|
||
|
}
|