alakesh.haloi
BAN USER
Comments (3)
Reputation -5
Page:
1
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
0
of 0 vote
#include<stdio.h>
int main(int argc, char *argv[]){
int count = 0;
int left = 0;
int right = 1;
int sum = 0;
int tmp = 0;
scanf("%d", &count);
scanf("%d", &sum);
int arr[count];
for (int i=0; i<count;i++){
scanf("%d",arr+i);
}
tmp = arr[0];
while(right < count){
printf("tmp = %d", tmp);
if (tmp == sum){
printf("left = %d right = %d ", left, right-1);
return 0;
}
if (tmp > sum) {
tmp = tmp - arr[left];
left++;
}
if (tmp < sum){
tmp = tmp + arr[right];
right++;
}
}
}
- alakesh.haloi September 08, 2016Comment hidden because of low score. Click to expand.
-1
of 1 vote
#include<stdio.h>
int main(){
printf("%u\n",((unsigned int)~0));
}
Page:
1
CareerCup is the world's biggest and best source for software engineering interview preparation. See all our resources.
- alakesh.haloi September 08, 2016