3 arrays/prefix sum array/main.cpp
//Find index of equilibrium point else -1 O(N) time ans O(N) space
Find index of equilibrium point else -1 O(N) time ans O(N) space
Find index of equilibrium point else - 1 O ( N ) time ans O ( N ) space
int findEquilibrium(int arr[], int n){
    int s_sum[n];
    int p_sum[n];
    generateSuffixSum(s_sum,arr,n);
    generatePrefixSum(p_sum,arr,n);
    for(int i=0; i<n;i++){
        if(p_sum[i] == s_sum[i]){
            return i;
        }
    }
    return -1;
}
int findEquilibrium ( int arr [ ] , int n ) { int s_sum [ n ] ; int p_sum [ n ] ; generateSuffixSum ( s_sum , arr , n ) ; generatePrefixSum ( p_sum , arr , n ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( p_sum [ i ] == s_sum [ i ] ) { return i ; } } return -1 ; }
Find index of equilibrium point else -1 O(N) time ans O(N) space
Find index of equilibrium point else - 1 O ( N ) time ans O ( N ) space