ExploreNeedy      
Share with -

Find odd Ball

Prev Logical Question Next Logical Question
Question:

Given n balls and a balance. Find odd ball(at most 1 odd ball in all the questions) with minimum number of weighings: (1) Odd ball exists(we know that the odd ball is light)
(2) Odd ball(Light/Heavy not known) exists.
(3) Odd ball is light/heavy known (odd ball may or maynot exists). We need to find the odd ball, if exists; tell that there is no odd ball if one doesn't exist.
(4) Odd ball is light/heavy not known, odd ball may or maynot exist.

Answer:

(1) Odd ball exists(we know that the odd ball is light). Ans: ceil(log(ceil(n/2))base3). 2->1,3->1,4->2,5->2,...9->2,10->3,11->3,....
(2) Odd ball(Light/Heavy not known) exists. Ans: ceil(log(n)base2). 3->2,4->2,5->3,6->3,...8->3,9->4,10->4,....
(3) Odd ball is light/heavy known (odd ball may or maynot exists). We need to find the odd ball, if exists; tell that there is no odd ball if one doesn't exist. Ans: 1 + ceil(log(ceil(n/2))base3). 2->1,3->2,4->2,...6->2,7->3,...18->3,19->4,...54->4,55->5,....
(4) Odd ball is light/heavy not known, odd ball may or maynot exist. Ans: 2 + ceil(log(floor(n/2))base2). 3->2,4->3,5->3,6->4,7->4,8->4,9->4,10->5,11->5,12->5,13->5,14->5,15->5,16->5,17->5,18->6,19->6,....

Prev Logical Question Next Logical Question

If you think that an important Logical interview questions or some answers are wrong in the site please contribute it to SiteAdmin@ExploreNeedy.com