Morningstar Hiring | Online Assessment questions 2024 | Find Pivot Index | Prefix Sum
Question · Posted Jun 2026
Problem Statement Given an integer array nums, return the leftmost pivot index. A pivot index is an index where: The sum of all elements strictly to the left of the index is equal to The sum of all elements strictly to the right of the index. If no such index exists, return -1. Example 1 Input nums = [1,7,3,6,5,6] Output 3 Explanation At index 3: Left Sum = 1 + 7 + 3 = 11 Right Sum = 5 + ...
The full answer & interview discussion are available to premium members.
Log in Create a free account