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

Where are c variables stored in memory?

601


What is function prototype in c language?

619


we called a function and passed something do it we have always passed the "values" of variables to the called function. such functions calles are called a) calls by reference b) calls by value c) calls by zero d) none of the above

643


How can I rethow can I return a sequence of random numbers which dont repeat at all?

710


What does emoji p mean?

610






What is a shell structure examples?

596


What is const and volatile in c?

572


What is hashing in c language?

620


What is indirection? How many levels of pointers can you have?

665


How to Throw some light on the splay trees?

623


What are 'near' and 'far' pointers?

627


An organised method of depicting the use of an area of computer memory used to signify the uses for different parts of the memory a) swap b) extended memory c) memory map d) all of the above

710


What is calloc()?

633


How can I prevent another program from modifying part of a file that I am modifying?

618


What is meant by recursion?

636