All prompts are owned by LeetCode. To view the prompt, click the title link above.
First completed : June 27, 2024
Last updated : June 27, 2024
Related Topics : Array, Math, Simulation, Combinatorics
Acceptance Rate : 78.74 %
int triangularSum(int* nums, int numsSize) {
for (int i = 0; i < numsSize; i++) {
for (int j = 0; j < numsSize - i - 1; j++) {
nums[j] = (nums[j] + nums[j + 1]) % 10;
}
}
return nums[0] % 10;
}
class Solution {
public int triangularSum(int[] nums) {
for (int i = 0; i < nums.length; i++) {
for (int j = 0; j < nums.length - i - 1; j++) {
nums[j] = (nums[j] + nums[j + 1]) % 10;
}
}
return nums[0] % 10;
}
}