This is one of the famous puzzles asked in interviews.

**Puzzle:**There are total hundred balls in a bag, numbered from 1..100(no two balls will have same number).From that bag one ball is stolen by a thief and you will be given that bag with remaining 99 balls. so you need to findout the missing ball in a better way?**Solution:**
step1:- calculate the sum of hundred balls. use some of n numbers formula n*(n+1)/2. i.e., ActualCount.

step2:- calculate the sum of remaining 99 balls.
i.e., ObtainedCount

step3:- missing ball number = ActualCount - ObtainedCount

If you have better solutions..please share them in comments!!

## No comments:

## Post a Comment