leetcode

Leetcode submissions
git clone git://git.laack.co/leetcode.git
Log | Files | Refs | README

max-diff.py (363B)


      1 class Solution:
      2     def maxAdjacentDistance(self, nums: List[int]) -> int:
      3         max_diff = 0
      4         # NOTE:
      5         # Since -1 == final element, we know -1 and 0 are adjacent :)
      6         for i in range(0, len(nums)):
      7             current = abs(nums[i - 1] - nums[i])
      8             if max_diff < current:
      9                 max_diff = current
     10         return max_diff