Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int solution(int A[], int N) {
- // write your code in C90
- int min=100000;
- int i,P;
- int first,second;
- int difference;
- first=A[0];
- second=0;
- for(i=1;i<N;i++)
- second+=A[i];
- min=abs(second-first);
- for(i=1;i<N;i++)
- {
- first+=A[i];
- second-=A[i];
- difference=abs(first-second);
- if (min>difference)
- min=difference;
- }
- return min;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement