Beats 100% || simplest code || just observe
Intuition\nWe need to ensure that 1 returns to its original position.\nRest of the numbers would automatically occupy their original positions.\n\n# Approach\nD
# Intuition\nWe need to ensure that 1 returns to its original position.\nRest of the numbers would automatically occupy their original positions.\n\n# Approach\nDo as per the problem statement for 1st index only.\nEg for n=8\n1->4->2->1\n3 operations needed\n\n# Complexity\n\n- Space complexity:\nO(1)\n\n# Code\n```\nclass Solution {\npublic:\n    int reinitializePermutation(int n) {\n        int curr = 1;\n        int cnt=0;\n        do\n        {\n            if (curr%2)\n            {\n                curr = n/2 + (curr-1)/2;\n\n            }\n            else curr/=2;\n            cnt+=1;\n        }while (curr!=1);\n        return cnt;\n    }\n};\n```
['C++']