EASY || Beats 80%
Approach\n Describe your approach to solving the problem. \nWE SEE THAT THE MINIMUM STEP WILL BE WHEN INDEX REACHES ITS IT OWN VALUE SO WE CAN JUST PERFORM THE 
# Approach\n<!-- Describe your approach to solving the problem. -->\nWE SEE THAT THE MINIMUM STEP WILL BE WHEN INDEX REACHES ITS IT OWN VALUE SO WE CAN JUST PERFORM THE OPERATIONS ON THE INDEX TO CALCULATE THE ANSWER.\n\n        if(index is even) ==> index /= 2;\n        else index = (n / 2) + ((index - 1) / 2);\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:O(1)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    int reinitializePermutation(int n) {\n        int tr = n - 2;\n        int ans = 0;\n\n        tr = tr / 2;\n        ans++;\n\n        while(tr != n - 2){\n            if(tr % 2 == 0){\n                tr /= 2;\n            }\n            else{\n                tr = (n / 2) + ((tr - 1) / 2);\n            }\n            ans++;\n        }\n\n        return ans;\n    }\n};\n```
['C++']