Given an array of size N in which every number is between 1
and N, determine if there are any duplicates in it. You are
allowed to destroy the array if you like.

Answer Posted / monika

the formula given for summation shud be (n*(n+1))/2

but it will solve the problem only if we have one duplicate.
if we have many duplicates then we can still get the
correct summation
for ex:
1 2 2 5 5

it has two duplicates but still total is 5*(5+1)/2=15

Is This Answer Correct ?    28 Yes 12 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

write a c program to input initial & final time in the format hh:mm and find the time intervel between them? Ex inputs are initial 06:30 final 00:05 and 23:22 final 22.30

2433


Write a routine to implement the polymarker function

4574


Can you send Code for Run Length Encoding Of BMP Image in C Language in linux(i.e Compression and Decompression) ?

4066


Design an implement of the inputs functions for event mode

3159


What is the difference between proc means and proc tabulate ? explain with a simple example when you have to use means or tabulate?

4039






What is data _null_? ,Explain with code when u need to use it in data step programming ?

3008


Given a spherical surface, write bump-mapping procedure to generate the bumpy surface of an orange

3067


Write a program to model an exploding firecracker in the xy plane using a particle system

3861


can you use proc sql to manpulate a data set or would u prefer to use proc report ? if so why ? make up an example and explain in detail

2561


What is the match merge ? compare data step match merge with proc sql merge - how many types are there ? data step vs proc sql

2621


write a function to give demostrate the functionality of 3d in 1d. function prototye: change(int value,int indexX,int indexY,int indexZ, int [] 1dArray); value=what is the date; indexX=x-asix indexY=y-axis indexZ=z-axis and 1dArray=in which and where the value is stored??

4381


why nlogn is the lower limit of any sort algorithm?

2537


Write a Program in 'C' To Insert a Unique Number Only. (Hint: Just Like a Primary Key Numbers In Database.) Please Some One Suggest Me a Better Solution for This question ??

2123


How do you verify if the two sentences/phrases input is an anagram using predefined functions in string.h and by using arrays?

2248


how to programme using switch statements and fuctions, a programme that will output two even numbers, two odd numbers and two prime numbers of the users chioce.

2345