I think Aditi's solution is correct. I was doing the same thing using XOR
function... So basically I was saying to use XOR and interviewer was asking
for something better... I could not find this solution...

Thanks Aditi.

Thanks & Regards
Vishal Jain
MNo: +91-9540611889
Tweet @jainvis
Blog @ jainvish.blogspot.com
Success taste better when target achieved is bigger.

P *We have a responsibility to the environment.*

*Before printing this e-mail or any other document, let's ask
ourselves whether we need a hard copy.*




On Fri, Jul 22, 2011 at 10:19 PM, aditi garg <aditi.garg.6...@gmail.com>wrote:

> I think this can be answered like dis...
> let us say that the persons have decided amongst themselves that if the the
> number of people wearing white in front of dem is even he wud say white and
> if odd he wud say black....
> Now suppose the 100th person counts the number of hats and finds it to be
> even... he wud say white...
> now the 99th person will do the same...if he still finds the number to be
> even and since the 100th person sed white(i.e even) he would say black...now
> if the 100th person had sed black (ie odd white) and the count comes out to
> be even thus 99 wud be wearing a white hat...
> Now that 98th person knows dat 99 had sed the correct hat and using the
> same method can say the correct hat color...thus all can be saved except the
> 100th prisoner...
> Also note dat the 100th prisoner also has a 50% chance to survive...
>
> Hope dis helps :)
>
>
> On Fri, Jul 22, 2011 at 10:05 PM, Shubham Maheshwari <
> shubham....@gmail.com> wrote:
>
>> could some1 plz post the xplainations ...
>>
>>
>> On Fri, Jul 22, 2011 at 8:04 PM, Pankaj <jatka.oppimi...@gmail.com>wrote:
>>
>>> Chetan,
>>>
>>> No. How could you relate this problem with that? Do you find something
>>> similar?
>>>
>>> ~
>>> Pankaj
>>>
>>>
>>> On Fri, Jul 22, 2011 at 8:01 PM, chetan kapoor <
>>> chetankapoor...@gmail.com> wrote:
>>>
>>>> josehus problem???
>>>>
>>>>
>>>> On Fri, Jul 22, 2011 at 7:57 PM, Pankaj <jatka.oppimi...@gmail.com>wrote:
>>>>
>>>>> Skipp Riddle,
>>>>> Yes.
>>>>> 100th prisoner will risk his life. Similar puzzle was discuss recently.
>>>>> Does anyone remember the name or thread?
>>>>>
>>>>>
>>>>> ~
>>>>> Pankaj
>>>>>
>>>>>
>>>>> On Fri, Jul 22, 2011 at 7:55 PM, SkRiPt KiDdIe <anuragmsi...@gmail.com
>>>>> > wrote:
>>>>>
>>>>>> Worst case 99 get released.
>>>>>> Is that correct..?
>>>>>>
>>>>>>  --
>>>>>> You received this message because you are subscribed to the Google
>>>>>> Groups "Algorithm Geeks" group.
>>>>>> To post to this group, send email to algogeeks@googlegroups.com.
>>>>>> To unsubscribe from this group, send email to
>>>>>> algogeeks+unsubscr...@googlegroups.com.
>>>>>> For more options, visit this group at
>>>>>> http://groups.google.com/group/algogeeks?hl=en.
>>>>>>
>>>>>
>>>>>  --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "Algorithm Geeks" group.
>>>>> To post to this group, send email to algogeeks@googlegroups.com.
>>>>> To unsubscribe from this group, send email to
>>>>> algogeeks+unsubscr...@googlegroups.com.
>>>>> For more options, visit this group at
>>>>> http://groups.google.com/group/algogeeks?hl=en.
>>>>>
>>>>
>>>>  --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Algorithm Geeks" group.
>>>> To post to this group, send email to algogeeks@googlegroups.com.
>>>> To unsubscribe from this group, send email to
>>>> algogeeks+unsubscr...@googlegroups.com.
>>>> For more options, visit this group at
>>>> http://groups.google.com/group/algogeeks?hl=en.
>>>>
>>>
>>>  --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To post to this group, send email to algogeeks@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> algogeeks+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> Aditi Garg
> Undergraduate Student
> Electronics & Communication Divison
> NETAJI SUBHAS INSTITUTE OF TECHNOLOGY
> Sector 3, Dwarka
> New Delhi
>
> 9718388816
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to