Skip to content

Code Issue #1

Open
Open
@JitenderBhati

Description

@JitenderBhati

For question no 16.c of arrays there is a minor issue in Method 3

int findEquilibriumIndex(int a[],int n){
int i = 0,j;
int sum = 0, sumLeft = 0;

for(i=0; i<n; i++){
	sum += a[i];
}
for(j=0;j<n;j++){
	sum = sum - a[j];
	**sumLeft += a[j];** //Should have come after if condition
	if(sum == sumLeft){
		return j;
	}
}
return 0;

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions