Solution in Typescript. Works fast :3
IntuitionThink of it like stacking blocks on top of one another, where each block is an element of the array.ApproachSteps
Created a variable named res
Added in
# Intuition
Think of it like stacking blocks on top of one another, where each block is an element of the array.

# Approach
 ## Steps
1. Created a variable named `res`
2. Added `init` to `res`
3. Looped through the length of array (`nums.length`) and ran each element of array through the function.
4. Returned `res`

## Important detail
- `accum`: Accumulated result throughout the iteration
- `curr`: The current value being passed to the function. First element in first iteration, second in second iteration, etc.

# Complexity
- Time complexity: O(N)

- Space complexity: O(1)

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

function reduce(nums: number[], fn: Fn, init: number): number {
    let res: number = init
    
    for(let i: number = 0; i < nums.length; i++){
        res = fn(res, nums[i])
    }

    return res;
};
```
['TypeScript']