Tap here to switch tabs
Problem
Submissions

Problem: Sum of All Odd Length Subarrays

med
30 min
Try to solve the Sum of All Odd Length Subarrays problem.

Statement

Given an array of positive integers arr, return the sum of all possible subarrays that have an odd length.

A subarray is a contiguous sequence of elements within the array.

Constraints:

  • 1≤1 \leq arr.length ≤100\leq 100

  • 1≤1 \leq arr[i] ≤1000\leq 1000

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Sum of All Odd Length Subarrays

med
30 min
Try to solve the Sum of All Odd Length Subarrays problem.

Statement

Given an array of positive integers arr, return the sum of all possible subarrays that have an odd length.

A subarray is a contiguous sequence of elements within the array.

Constraints:

  • 1≤1 \leq arr.length ≤100\leq 100

  • 1≤1 \leq arr[i] ≤1000\leq 1000