Given an array of size N in which every number is between 1
and N, determine if there are any duplicates in it. You are
allowed to destroy the array if you like.

Answers were Sorted based on User's Feedback



Given an array of size N in which every number is between 1 and N, determine if there are any dupli..

Answer / purnank

Get the summation. If it is not equal to (2N + 1)/2, you
surely have duplicates.

Is This Answer Correct ?    11 Yes 46 No

Post New Answer

More C Code Interview Questions

#define DIM( array, type) sizeof(array)/sizeof(type) main() { int arr[10]; printf(“The dimension of the array is %d”, DIM(arr, int)); }

1 Answers  


main() { char a[4]="HELL"; printf("%s",a); }

3 Answers   Wipro,


Is it possible to type a name in command line without ant quotes?

1 Answers   Excel, Infosys,


respected sir, i did my MCA in 2013 when i am going to attend to an interview i was asked about my project how will i explain my project could please help me in this and my project title is "Social Networking Site For Social Responsibility"

1 Answers   Genpact, Ozdocs,


main() { unsigned int i=10; while(i-->=0) printf("%u ",i); }

2 Answers   HP,






Write a program to check whether the number is prime and also check if it there i n fibonacci series, then return true otherwise return false

1 Answers   Cognizant, lenovo,


Write a program that produces these three columns sequence nos. using loop statement Sequence nos. Squared Squared + 5 1 1 6 2 4 9 3 9 14 4 16 21 5 25 30

1 Answers   GoDB,


main() { int i = 258; int *iPtr = &i; printf("%d %d", *((char*)iPtr), *((char*)iPtr+1) ); }

1 Answers  


main() { char *p="hai friends",*p1; p1=p; while(*p!='\0') ++*p++; printf("%s %s",p,p1); }

3 Answers  


How can i find first 5 natural Numbers without using any loop in c language????????

2 Answers   Microsoft,


typedef struct error{int warning, error, exception;}error; main() { error g1; g1.error =1; printf("%d",g1.error); }

1 Answers  


write a origram swaoing valu without 3rd variable

2 Answers  


Categories