1936. Add Minimum Number of Rungs

Updated: 2024-03-12
1 min read
[]

On This Page

LeetCode problem 1936

class Solution:
    def addRungs(self, rungs: List[int], dist: int) -> int:
        rungs = [0] + rungs
        return sum((b - a - 1) // dist for a, b in pairwise(rungs))