# LC5521 Find Pivot Index **Idea.** Left sum vs total - left - a[i]. ```python def pivotIndex(a): tot, left = sum(a), 0 for i, x in enumerate(a): if left == tot - left - x: return i left += x return -1 ``` **Interview habit.** Say the brute force, then the optimisation, then edge cases. Rehearse that flow with [interview copilot app](https://www.linkjob.ai/coding-interview-copilot/) (https://www.linkjob.ai/).