leetcode

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

commit 59e66b07398f639b276d5fad8f751523ab0d8e1b
parent 43527ce1012dffda965e2cacd045df4a0151845d
Author: Dimitrije Dobrota <mail@dimitrijedobrota.com>
Date:   Sat,  6 Jul 2024 16:48:03 +0200

Daily Problem

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

diff --git a/Problems/2582.cpp b/Problems/2582.cpp @@ -0,0 +1,7 @@ +class Solution { + public: + int passThePillow(int n, int time) const { + time = time % ((n - 1) * 2) + 1; + return min(time, n * 2 - time); + } +}; diff --git a/README.md b/README.md @@ -1192,6 +1192,7 @@ for solving problems. | 2568 | Medium | [Minimum Impossible OR](Problems/2568.cpp) | | 2571 | Medium | [Minimum Operations to Reduce an Integer to 0](Problems/2571.cpp) | | 2579 | Medium | [Count Total Number of Colored Cells](Problems/2579.cpp) | +| 2582 | Easy | [Pass the Pillow](Problems/2582.cpp) | | 2588 | Medium | [Count the Number of Beautiful Subarrays](Problems/2588.cpp) | | 2592 | Medium | [Maximize Greatness of an Array](Problems/2592.cpp) | | 2593 | Medium | [Find Score of an Array After Marking All Elements](Problems/2593.cpp) |