2221. Find Triangular Sum of an Array

Обновлено: 2024-03-12
1 мин
[]

Содержание

LeetCode problem 2221

class Solution:
    def triangularSum(self, nums: List[int]) -> int:
        n = len(nums)
        for i in range(n, 0, -1):
            for j in range(i - 1):
                nums[j] = (nums[j] + nums[j + 1]) % 10
        return nums[0]