458. Poor Pigs - LeetCode |August Leetcode challenge|CODE + EXPLANATION

Pubblicato il: 06 agosto 2022
sul canale di: Technology Encroyable
63
4

Leetcode problem-- https://leetcode.com/problems/poor-pigs/

Github Python -- https://github.com/PriyaUpadhyay/leet...

here are buckets buckets of liquid, where exactly one of the buckets is poisonous. To figure out which one is poisonous, you feed some number of (poor) pigs the liquid to see whether they will die or not. Unfortunately, you only have minutesToTest minutes to determine which bucket is poisonous.

You can feed the pigs according to these steps:

Choose some live pigs to feed.
For each pig, choose which buckets to feed it. The pig will consume all the chosen buckets simultaneously and will take no time.
Wait for minutesToDie minutes. You may not feed any other pigs during this time.
After minutesToDie minutes have passed, any pigs that have been fed the poisonous bucket will die, and all others will survive.
Repeat this process until you run out of time.
Given buckets, minutesToDie, and minutesToTest, return the minimum number of pigs needed to figure out which bucket is poisonous within the allotted time.


In questa pagina del sito puoi guardare il video online 458. Poor Pigs - LeetCode |August Leetcode challenge|CODE + EXPLANATION della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Technology Encroyable 06 agosto 2022, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 63 volte e gli è piaciuto 4 spettatori. Buona visione!