Given an array of length N containing integers between 1
and N, determine if it contains any duplicates.

Answer Posted / ash

If the question is just to find just whether there are
duplicates in the array, we can just sum all the numbers
and if the sum is less than n(n+1)/2, some number in the
array has repeated.

Is This Answer Correct ?    8 Yes 39 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is %d used for?

585


in iso what are the common technological language?

1637


Can we declare variables anywhere in c?

580


What is pragma in c?

629


In C language, a variable name cannot contain?

745






Why isnt any of this standardized in c?

638


Is calloc better than malloc?

578


What are shell structures used for?

601


Explain is it valid to address one element beyond the end of an array?

736


What does return 1 means in c?

588


What will be your course of action for a push operation?

669


Explain how do you declare an array that will hold more than 64kb of data?

904


Differentiate call by value and call by reference?

569


cavium networks written test pattern ..

3596


What is a sequential access file?

648