Problem statement — find sum of all odd length subarray’s of a given array. Example : arr = [4,3,6,5,2] possible odd length arrays are [4] [3] [6] [5] [2] [4,3,6] [3,6,5] [6,5,2] [4,3,6,5,2] sum of all odd subarray’s = 80 You can try this problem on leetcode , link is…