Java 1 ms 2 line mathematical solution


  • 0
    C
        public int poorPigs(int buckets, int minutesToDie, int minutesToTest) {
            double temp = Math.ceil(minutesToTest/minutesToDie);
            return (int)Math.round(Math.log(buckets)/Math.log(temp));
        }
    

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.