Salesforce SWE Interview Question 2023 September | Arrays and Sorting | off-campus

Salesforce · Question · Posted Jun 2026

Question 1 Problem Statement Given an array of intervals where intervals[i] = [start_i, end_i], merge all overlapping intervals and return an array of the non-overlapping intervals that cover all the intervals in the input. Constraints 1 <= intervals.length <= 104 intervals[i].length == 2 0 <= start_i <= end_i <= 104 Examples Example 1: Input: intervals = [[1,3],[2,6],[8,10],[15,18]] Output: [[1,6],[8,10],[15,18]] Explanation 1: After sorting by start time: [1,3] and [2,6] overlap because 2 <= 3. They merge into [1,6]. [8,10] does ...

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

Log in Create a free account