877. Triangular Sum
Given an array of integers, the triangular sum is the value of the only element present in the array after performing a specific process. Starting with the given array, if the array has only one element, the process ends. Otherwise, create a new array with one less element. For each index i, assign the value of the new array at index i as the sum of the corresponding elements in the original array (nums[i] + nums[i+1]) modulo 10. Replace the original array with the new array and repeat the process until only one element remains. Print the triangular sum of the final array.
The first line contains a single integer N, the length of the array. The next line contains N space-separated integers representing the elements of the array.
An integer representing the triangular sum.
5 1 2 3 4 5
1 <= N <= 10^3