My standard problem
Hi,
This is one of the problems that I always wished to set as an example to illustrate the orientation in thinking while solving a software problem.
Ok here is the problem
I have a list of consequitive numbers ( example : b/n 50-60). They are arranged in an unsorted manner.
One of the number in the range is missing.
You have to identify that number. The solution should be in O(n).
I have used the problem as an example a hundred times. So people who have been present during these session can restrain themselves. Others hack into your brains.
Rahul.
This is one of the problems that I always wished to set as an example to illustrate the orientation in thinking while solving a software problem.
Ok here is the problem
I have a list of consequitive numbers ( example : b/n 50-60). They are arranged in an unsorted manner.
One of the number in the range is missing.
You have to identify that number. The solution should be in O(n).
I have used the problem as an example a hundred times. So people who have been present during these session can restrain themselves. Others hack into your brains.
Rahul.
3 Comments:
can this be a solution ?
no you want =(60*61)/2 - (50*51)/2
I think the answer is AP (arithmetic progression)
both of you are right.
All we have to do is get the expected sum and the real sum and bingo , we have the answer
Post a Comment
<< Home