C++ simple solution 100% beat
Only need to focus on one element, 1 for example. And what we should do is to think about how many times needed for it to go back to the starting point.\n\nclas
Only need to focus on one element, 1 for example. And what we should do is to think about how many times needed for it to go back to the starting point.\n```\nclass Solution {\npublic:\n    int reinitializePermutation(int n) {\n        int count = 0;\n        int pos = 1;\n        do{\n            if(pos & 1)\n                pos = n/2 + (pos - 1) / 2;\n            else\n                pos = pos / 2;\n            count++;\n        }while(pos!=1);\n        return count;\n    }\n};\n```
[]