SIMPLILEARN Hiring On-Campus OA (2022) | Sum of All Odd Length Subarrays
Question · Posted Jun 2026
Problem Statement Given an array of positive integers arr, return the sum of all possible odd-length subarrays. A subarray is a contiguous part of the array. Example Input arr = [1,4,2,5,3] Output 58 Constraints 1 <= arr.length <= 100 1 <= arr[i] <= 1000
The full answer & interview discussion are available to premium members.
Log in Create a free account