Sum of minimum elements of all subarrays
Filed under PhonePe · Also reported at Coredge.io
The question
Compute the sum of the minimum elements over all subarrays; brute force O(N^2) was accepted, then optimized to O(N) with a stack, and the interviewer pointed out failing test cases.
No write-up yet. Related questions below have one.
Related PhonePe questions
Collected from public candidate posts and coding forums. Updated Nov 2026.