Cracking the coding interview: Equilibrium Point — 8

Input: 
n = 5
A[] = {1,3,5,2,2}
Output: 3
Explanation:
For second test case
equilibrium point is at position 3
as elements before it (1+3) =
elements after it (2+2).
Input:
n = 1
A[] = {1}
Output: 1
Explanation:
Since its the only element hence
its the only equilibrium point.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store