파비의 매일매일 공부기록

Today's Challenge 본문

Problem Solving/LeetCode

Today's Challenge

fabichoi 2022. 8. 6. 23:45

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

 

Poor Pigs - LeetCode

Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.

leetcode.com

이건 대체 어떻게 푸는거지..
뭔가 버켓을 활용하는거 같은데 =_=

class Solution:
    def poorPigs(self, buckets: int, minutesToDie: int, minutesToTest: int) -> int:
        tmp = log2(buckets)
        t = ceil(minutesToTest/minutesToDie)
        
        if t == 1:
            return ceil(tmp)
        return ceil(tmp / log2(t+1))
반응형

'Problem Solving > LeetCode' 카테고리의 다른 글

Today's Challenge  (0) 2022.08.08
Today's Challenge  (0) 2022.08.07
Today's Challenge  (0) 2022.08.05
Today's Challenge  (0) 2022.08.04
Today's Challenge  (0) 2022.08.03
Comments