leetcodeSolution to some Leetcode problems written in C++ |
git clone git://git.dimitrijedobrota.com/leetcode.git |
Log | Files | Refs | README | LICENSE | |
1806.cpp (223B)
1 class Solution { 2 public: 3 int reinitializePermutation(int n) { 4 int res = 0, i = 1; 5 while (res == 0 || i > 1) { 6 i = i * 2 % (n - 1); 7 res++; 8 } 9 return res; 10 } 11 };