ByteDance SDE Interview Question 2025 January | Monotonic Stacks & Combinatorics | Off-Campus
ByteDance · Question · Posted Jun 2026
Question 1: Sum of Subarray Minimums Problem Statement Given an array of integers arr, find the sum of min(b), where b ranges over every (contiguous) subarray of arr. Since the answer may be massive, return the answer modulo 10^9 + 7. Constraints 1 <= arr.length <= 3 * 104 1 <= arr[i] <= 3 * 104 Example Input: arr = [3,1,2,4] Output: 17 Explanation: The subarrays are: [3], min = 3 [1], min = 1 [2], min = 2 [4], ...
The full answer & interview discussion are available to premium members.
Log in Create a free account