1. an array has n/2 distinct elements and one element which is repeated n/2 times.. find out that element.. ofcourse.. in O(n)
2. there is an array of size n. it has n-1 distinct elements, each of lying in the range from 1 to n.. find out the element that has been repeated once.. do that in O(1) extra space..
1 year ago
1 comment:
well. i opened this comment so that i could put a hint in there.. but i dont think i need to put one..these two are pretty straight forward and the tricks used to solve these will be useful in solving 10s of other similar array questions... so solve them yourselves
Post a Comment