leetcode

Solution to some Leetcode problems written in C++
git clone git://git.dimitrijedobrota.com/leetcode.git
Log | Files | Refs | README | LICENSE

2221.cpp (300B)


      1 class Solution {
      2   public:
      3     int triangularSum(vector<int> &nums) {
      4         for (int k = 0; k < nums.size() - 1; k++) {
      5             for (int i = 1; i < nums.size() - k; i++) {
      6                 nums[i - 1] = (nums[i - 1] + nums[i]) % 10;
      7             }
      8         }
      9         return nums.front();
     10     }
     11 };