Given an array of length N containing integers between 1
and N, determine if it contains any duplicates.
Answer Posted / sid
duplicate = False;
for (i =1; i <= N; i++)
{
a[a[i] % N] += N;
}
for (i =1; i <= N; i++)
{
if (a[i] / N >= 2)
{
duplicate = True;
}
}
return duplicate;
Is This Answer Correct ? | 14 Yes | 17 No |
Post New Answer View All Answers
plz let me know how to become a telecom protocol tester. thank you.
What is the explanation for the dangling pointer in c?
how can i access hard disk address(physical address)? are we access hard disk by using far,near or huge pointer? if yes then please explain.....
Explain how are 16- and 32-bit numbers stored?
1) There is a singing competition for children going to be conducted at a local club. Parents have been asked to arrive at least an hour before and register their children’s names with the Program Manager. Whenever a participant registers, the Program Manager has to position the name of the person in a list in alphabet order. Write a program to help the Program Manager do this by placing the name in the right place each time the Program Manger enters a name. The Logic should be written in Data Structures?
Explain what is the heap?
how to capitalise first letter of each word in a given string?
pgm to find number of words starting with capital letters in a file(additional memory usage not allowed)(if a word starting with capital also next letter in word is capital cann't be counted twice)
What does %p mean c?
Explain how can type-insensitive macros be created?
What is the use of the function in c?
Is a house a shell structure?
What is the data segment that is followed by c?
How old is c programming language?
Is it possible to use curly brackets ({}) to enclose single line code in c program?