Given an array of length N containing integers between 1
and N, determine if it contains any duplicates.
Answer Posted / sid
duplicate = False;
for (i =1; i <= N; i++)
{
a[a[i] % N] += N;
}
for (i =1; i <= N; i++)
{
if (a[i] / N >= 2)
{
duplicate = True;
}
}
return duplicate;
| Is This Answer Correct ? | 14 Yes | 17 No |
Post New Answer View All Answers
What is the difference between mpi and openmp?
What is modifier & how many types of modifiers available in c?
What is data structure in c and its types?
Explain what does a function declared as pascal do differently?
‘ C’ PROGRAME TO SHOW THE TYPE OF TRANGLE BY ACCEPTING IT’S LENGTH .
what is the height of tree if leaf node is at level 3. please explain
what are # pragma staments?
Why c is called a middle level language?
Which header file is used for clrscr?
What are the types of pointers in c?
Give me the code of in-order recursive and non-recursive.
Using which language Test cases are added in .ptu file of RTRT unit testing???
What is #include conio h?
Can we add pointers together?
What is a null pointer assignment error? What are bus errors, memory faults, and core dumps?