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
Input is "rama loves rajesh and rajesh Loves rama also and rajesh wear gloves and bloves" To print output is count the numbers of times repeted the word love without case sensitive.
Can you please explain the scope of static variables?
What is a union?
What is c value paradox explain?
What is getch?
What is the purpose of sprintf() function?
What is difference between array and pointer in c?
What is meant by preprocessor in c?
Is register a keyword in c?
What is keyword in c?
Why we use void main in c?
What are the storage classes in C?
What is local and global variable in c?
How do I swap bytes?
What do you mean by invalid pointer arithmetic?