Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8228117
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T16:21:24+00:00 2026-06-07T16:21:24+00:00

A friend of mine was asked this question for an interview and couldn’t solve

  • 0

A friend of mine was asked this question for an interview and couldn’t solve it at that moment. Thought I would share the same.

There are a thousand choco-chip cookies with one of them poisoned. You
have access to 10 lab rats per day. Each rat can nibble on any number
of cookies and each cookie can be nibbled by any number of rats. After
a rat nibbles on a poisoned cookie, it takes a day to see the after
effects on the rat if it were poisoned.

Optimize on the number of days. I was able to come up with an algorithm to find the poisoned cookie in 2 days, although I believe there exists a way to do this in 1 day

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T16:21:25+00:00Added an answer on June 7, 2026 at 4:21 pm

    I think I got it.

    Imagine a binary tree with the 1024 cookies as the root (This number just comes out cleaner, but this will work for any number less than 1024). Break that 1024 cookies into two groups of 512, each of those groups is the child of the root. Then break each of those groups of 512 into groups of 256 and let those be the children of each of them and so on. You should end up with 11 levels of the tree.

    Assign each rat to a level of the tree except the root. Each rat will eat only the cookies on the left branches of their level. The next day, iterate through the tree and for each rat that died, follow the left branch, for each rat that lived, follow the right branch. The resulting cookie should be the poisoned one.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

A friend of mine was asked the following question today at interview for the
Friend of mine got asked the following question in an interview recently and im
A friend of mine asked to create a static website and I found that
A friend of mine was asked, during a job interview, to write a program
A friend of mine (from work) asked me a question. Remove the static keyword
Sorry for the double post: a friend of mine asked this on the mailing
A friend of mine was recently asked in a job interview to tell the
A friend of mine has asked me a question which i do not know
Possible Duplicate: How would you implement tail efficiently? A friend of mine was asked
A friend of mine asked: if I have two dice and I throw both

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.