Skip to content

Commit 32450ba

Browse files
authored
Solution to Triangular Sum (#105)
* Added Regular Expression matching * Revert "Added Regular Expression matching" This reverts commit 4449207. * adding solution of daily probs
1 parent 75a5fec commit 32450ba

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
class Solution {
2+
public int triangularSum(int[] nums) {
3+
int n = nums.length;
4+
5+
for (int size = n; size > 1; size--) {
6+
for (int i = 0; i < size - 1; i++) {
7+
nums[i] = (nums[i] + nums[i + 1]) % 10;
8+
}
9+
}
10+
11+
return nums[0];
12+
}
13+
}

0 commit comments

Comments
 (0)