✅Maths || 2*i,2*i+1 || cPP
\n# Code\n\nclass Solution {\npublic:\n    int reinitializePermutation(int n) {\n        int h=n/2;\n        int i=1;\n        int cnt=0;\n        while(1){\n  
\n# Code\n```\nclass Solution {\npublic:\n    int reinitializePermutation(int n) {\n        int h=n/2;\n        int i=1;\n        int cnt=0;\n        while(1){\n            if(i<h){\n                i=i*2;\n            }\n            else i=((i*2)+1)%n;\n            cnt++;\n            if(i==1)return cnt;\n        }\n        return 0;\n    }\n};\n```
['Array', 'Math', 'Simulation', 'C++']