new paste || ipv4:js fail, n/a or broken? | ipv6:js fail, n/a or broken? ||

paste 35886/356e | 5 views since 2026-11-05 10:16:05 | text/plain | wrap || empty reply | copy reply | quote reply
js:(
# Find Pivot Index (LeetCode 724): Interview Notes

## Problem
Find the leftmost index where the sum of elements to the left equals the sum to the right.

## Approach
Compute the total once. Walk left to right keeping leftSum; at index i the right sum is total - leftSum - nums[i]. Return i when they match, then add nums[i] to leftSum. Negative numbers are allowed, so do not try to break early based on sign.

## Complexity
O(n) time, O(1) space.

## Interview tip
Prefix-sum thinking here carries over to subarray-sum problems; mention the connection. If you want live help practicing explanations like this, see [AI tool for job interviews](https://www.linkjob.ai/).

*Disclosure: I work on Linkjob AI.*