MEDIATEK Hiring Challenge | On-Campus OA (2024) | Sum of Subarray Minimums Problem

Question · Posted Jun 2026

Problem Statement Given an integer array arr, find the sum of the minimum value of every possible contiguous subarray. Since the answer can be very large, return it modulo 10^9 + 7. A subarray is a contiguous part of an array. Example 1 Input arr = [3,1,2,4] Output 17 Explanation Subarrays and their minimums: [3]       -> 3 [3,1]     -> 1 [3,1,2]   -> 1 [3,1,2,4] -> 1 [1]       -> 1 [1,2]   ...

The full answer & interview discussion are available to premium members.

Log in Create a free account