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
the factorial of non-negative integer n is written n! and is defined as follows: n!=n*(n-1)*(n-2)........1(for values of n greater than or equal to 1 and n!=1(for n=0) Perform the following 1.write a c program that reads a non-negative integer and computes and prints its factorial. 2. write a C program that estimates the value of the mathematical constant e by using the formula: e=1+1/!+1/2!+1/3!+.... 3. write a c program the computes the value ex by using the formula ex=1+x/1!+xsquare/2!+xcube/3!+....
Explain the difference between #include "..." And #include <...> In c?
Explain what are reserved words?
Tell me what are bitwise shift operators?
What is typeof in c?
What does a function declared as pascal do differently?
write a sorting prgm to sort 50 nos and sum them and also remove all the occurrences of 15 and print it?
What are variables c?
What does c mean before a date?
Are pointers integer?
In c language can we compile a program without main() function?
What is stack in c?
What is maximum size of array in c?
Write a program, where i have a grid with many cells, how many paths are possible from one point to other desired points.
What should malloc(0) do? Return a null pointer or a pointer to 0 bytes?