Pergunta de entrevista da empresa Microsoft

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