Python data engineering interview problem. Difficulty: intermediate. Pattern: Searching. About 15 minutes. Part of the Pro drill bank.
Daily sales sit in a list. A 'pivot' day is one where the sum on the left equals the sum on the right. Planning uses it as a mid-campaign checkpoint.
Find the pivot index of a sales list (left sum equals right sum).
Input: pivot_index([1, 7, 3, 6, 5, 6]) Output: 3 This input follows the stated rules and produces this output.
Topics: lakebench, python, prefix-sums.
More Python interview questions · All interview problems · Learn data engineering
Interview-style drill: Find the index where the sum of sales to its left equals the sum of sales to its right.
Find the pivot index of a sales list (left sum equals right sum).