Array Reduce Transformation
IntuitionApproachComplexity
Time complexity:

Space complexity:
Code
![Capture d’écran 2025-03-21 à 15.59.32.png](https://assets.leetcode.com/users/images/c791c798-945c-460e-bf99-a44b6db348ac_1742569187.090847.png)

# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```typescript []
type Fn = (accum: number, curr: number) => number

function reduce(nums: number[], fn: Fn, init: number): number {
    let value = init
    nums.forEach(num => value = fn(value, num))

    return value

};
```
['TypeScript']