https://leetcode.com/problems/widest-vertical-area-between-two-points-containing-no-points/description/ Easy

Решение

class Solution {
    fun maxWidthOfVerticalArea(points: Array<IntArray>): Int {
        val xs = IntArray(points.size) { i -> points[i][0] }
        xs.sort()
        var maxGap = 0
        for (i in 1 until xs.size) {
            val gap = xs[i] - xs[i - 1]
            if (gap > maxGap) maxGap = gap
        }
        return maxGap
    }
}