c++ | easy | fast
\n\n# Code\n\nclass Solution {\npublic:\n       int reinitializePermutation(int n) {\n        int res = 0, i = 1;\n        while (res == 0 || i > 1) {\n        
\n\n# Code\n```\nclass Solution {\npublic:\n       int reinitializePermutation(int n) {\n        int res = 0, i = 1;\n        while (res == 0 || i > 1) {\n            i = i * 2 % (n - 1);\n            res++;\n        }\n        return res;\n    }\n};\n```
['C++']