Skip to content

Practice Find Triangular Sum of an Array

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Medium#2221
LeetCode Problem

Find Triangular Sum of an Array

Problem Statement

While nums has more than one element, replace it with a new array whose entry i is (nums[i] + nums[i + 1]) % 10 for every adjacent pair. Each replacement shortens the array by one. Return the sole value remaining.

Source: Find Triangular Sum of an Array on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
nums = [1,2,3,4,5]
Output
8

# Example 2

Input
nums = [5]
Output
5

Constraints

1 <= nums.length <= 1000
0 <= nums[i] <= 9

Related LeetCode Problems

Practice more problems similar to Find Triangular Sum of an Array.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.