Are their any space or time constraints ?
On Jul 8, 3:21 pm, Piyush Sinha ecstasy.piy...@gmail.com wrote:
is there anyting special about the array???
or it is aribitary array??
On 7/8/11, Dumanshu duman...@gmail.com wrote:
given an array of intergers. find the any integer that occurs only
How about this ?
1. We construct a graph with these nodes.
2. We make an incoming edge on a node if it is created using some
other node. Ex: 7=5+2. So 7 will have 1 incoming and 5 2 will have
outgoing.
3. Select all the nodes which only have outgoing edges. These would be
the actual distances
The greatest chance i.e. 100% chance would be at position number 366.
(By Pigeonhole principle).
On Jul 7, 2:34 pm, swetha rahul swetharahu...@gmail.com wrote:
At a movie theater, the manager announces that they will give a free ticket
to the first person in line whose birthday is the same as
a) Find min(A). - O(n)
b) Find max(A) - O(n)
c) Calculate sum of natural numbers starting from min(A) to max(A) -
O(n)
d) Calculate sum of all numbers in the array. - O(n)
e) If sum in step c) is not same as sum in step d), then elements are
not consecutive. If the sum is same, then they are