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

Which one would you prefer - a macro or a function?

867


What is meant by errors and debugging?

884


What are high level languages like C and FORTRAN also known as?

933


What is the role of && operator in a program code?

815


How do I use strcmp?

850


Write a program on swapping (100, 50)

883


How to check whether string is a palindrome, WITHOUT USING STRING FUNCTIONS?

16084


Did c have any year 2000 problems?

901


Write a program to find factorial of a number using recursive function.

884


how to find anagram without using string functions using only loops in c programming

2962


What is the -> in c?

809


can we change the default calling convention in c if yes than how.........?

2306


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

951


Is fortran still used in 2018?

819


What are qualifiers in c?

792