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
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 |
#include<stdio.h> main() { struct xx { int x=3; char name[]="hello"; }; struct xx *s=malloc(sizeof(struct xx)); printf("%d",s->x); printf("%s",s->name); }
write a c program to Create employee record by taking details like name, employee id, address and phone number. While taking the phone number, take either landline or mobile number. Ensure that the phone numbers of the employee are unique. Also display all the details
main() { register int a=2; printf("Address of a = %d",&a); printf("Value of a = %d",a); }
#define a 10 int main() { printf("%d..",a); foo(); printf("%d..",a); return 0; } void foo() { #undef a #define a 50 }
enum colors {BLACK,BLUE,GREEN} main() { printf("%d..%d..%d",BLACK,BLUE,GREEN); return(1); }
What is the match merge ? compare data step match merge with proc sql merge - how many types are there ? data step vs proc sql
main() { int i=300; char *ptr = &i; *++ptr=2; printf("%d",i); }
write a c program to print magic square of order n when n>3 and n is odd?
main() { extern int i; i=20; printf("%d",sizeof(i)); }
Is the following code legal? typedef struct a aType; struct a { int x; aType *b; };
#include<stdio.h> int main() { int a=3,post,pre; post= a++ * a++ * a++; a=3; pre= ++a * ++a * ++a; printf("post=%d pre=%d",post,pre); return 0; }
Printf can be implemented by using __________ list.