leetcode

Solution to some Leetcode problems written in C++
git clone git://git.dimitrijedobrota.com/leetcode.git
Log | Files | Refs | README | LICENSE

commit 25df156a12d0592b79d956c9c99c52fb404af70b
parent da47664efcdf452c35b6d4a7ad27ce932466ce91
Author: Dimitrije Dobrota <mail@dimitrijedobrota.com>
Date:   Sun, 29 Oct 2023 14:47:13 +0000

Daily Problem

Diffstat:
AProblems/0458.cpp | 7+++++++
MREADME.md | 1+
2 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/Problems/0458.cpp b/Problems/0458.cpp @@ -0,0 +1,7 @@ +class Solution { + public: + int poorPigs(int buckets, int minutesToDie, int minutesToTest) const { + const int tests = minutesToTest / minutesToDie + 1; + return ceil(log2(buckets) / log2(tests)); + } +}; diff --git a/README.md b/README.md @@ -304,6 +304,7 @@ for solving problems. | 0451 | Medium | [Sort Characters By Frequency](Problems/0451.cpp) | | 0452 | Medium | [Minimum Number of Arrows to Burst Balloons](Problems/0452.cpp) | | 0456 | Medium | [132 Pattern](Problems/0456.cpp) | +| 0458 | Hard | [Poor Pigs](Problems/0458.cpp) | | 0459 | Easy | [Repeated Substring Pattern](Problems/0459.cpp) | | 0460 | Hard | [LFU Cache](Problems/0460.cpp) | | 0472 | Hard | [Concatenated Words](Problems/0472.cpp) |