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 getch () for?
Why c is called free form language?
What is an endless loop?
How are Structure passing and returning implemented by the complier?
What is binary tree in c?
Why is struct padding needed?
How are pointers declared in c?
i want to switch my career from quailty assurance engineering to development kindly guide me from which programming language its better for me to start plz refer some courses or certifications too i have an experience of 1.5 yrs in QA field.Kindly guide me
Tell me can the size of an array be declared at runtime?
c program for searching a student details among 10 student details
State the difference between x3 and x[3].
Which programming language is best for getting job 2020?
What are types of preprocessor in c?
What are c identifiers?
Why isnt any of this standardized in c?