leetcodeSolution to some Leetcode problems written in C++ |
git clone git://git.dimitrijedobrota.com/leetcode.git |
Log | Files | Refs | README | LICENSE | |
2582.cpp (164B)
1 class Solution { 2 public: 3 int passThePillow(int n, int time) const { 4 time = time % ((n - 1) * 2) + 1; 5 return min(time, n * 2 - time); 6 } 7 };