-
1480. Running Sum of 1d Array javaLeetCode_Study_Plan/LeetCode 75 2022. 9. 25. 17:01
https://leetcode.com/problems/running-sum-of-1d-array/?envType=study-plan&id=level-1
class Solution { public int[] runningSum(int[] nums) { Integer[] ans = new Integer[nums.length]; ans[0] = nums[0]; for (int i = 1; i < nums.length; i++){ ans[i] = nums[i] + ans[i-1]; } for (int i = 1; i < nums.length; i++){ nums[i] = ans[i]; } return nums; } }
'LeetCode_Study_Plan > LeetCode 75' 카테고리의 다른 글
206. Reverse Linked List java (0) 2022.10.05 392. Is Subsequence java (0) 2022.10.04 [LeetCode 75] 중간 점검 (0) 2022.10.02 205. Isomorphic Strings java (0) 2022.09.26 724. Find Pivot Index java (1) 2022.09.25