BNP Paribas interview question

Write an algorithm to calculate the pivot index of an integer array https://leetcode.com/problems/find-pivot-index/description/