Microsoft interview question

Write a function to calculate the equilibrium index of a given array