diff --git "a/leetcode2/1easy/\354\235\264\354\244\200\354\227\264/3427.cpp" "b/leetcode2/1easy/\354\235\264\354\244\200\354\227\264/3427.cpp" new file mode 100644 index 00000000..989ee479 --- /dev/null +++ "b/leetcode2/1easy/\354\235\264\354\244\200\354\227\264/3427.cpp" @@ -0,0 +1,20 @@ +class Solution { + public: + int subarraySum(vector& nums) { + int output = 0; + + for (int i = 0; i < nums.size(); i++) + { + int tmp = 0; + for (int j = max(0, i - nums[i]); j <= i; j++) + { + tmp += nums[j]; + } + output += tmp; + } + + + return output; + + } + }; \ No newline at end of file