Pages

Friday, February 6, 2026

1480. Running Sum of 1d Array - leetcode solution

 class Solution {

    public int[] runningSum(int[] nums) {
        for(int idx = 1; idx<nums.length; idx++) {
            nums[idx] = nums[idx-1] + nums[idx];

        }

        return nums;
    }
}

No comments:

Post a Comment

3917. Count Indices With Opposite Parity (Brute Force) O(n2) + Optimized Solution O(n) + tips LEETCODE WEEKLY 500

  class Solution {     public int [] countOppositeParity ( int [] nums ) {          // approach 1 - checks every pair         int n = n...