0ms | Java Concise Solution
We only need to apply the formula for one number until its back to it\'s original place. In my case, I chose 1.\n\n\npublic int reinitializePermutation(int n) {
We only need to apply the formula for one number until its back to it\'s original place. In my case, I chose 1.\n\n```\npublic int reinitializePermutation(int n) {\n        int mid = n/2;\n\t\t// after first pemutation, 1 is at n/2 position\n        int x=n/2;\n\t\t// it takes one operation to get 1 at n/2 position\n        int cnt=1;\n\t\t// apply formula until 1 is not back at it\'s original positions, i.e 1\n        while(x!=1) {\n            if(x%2==1) {\n                x = mid + x/2;\n            } else {\n                x/=2;\n            }\n            cnt++;\n        }\n        return cnt;\n    }\n```
[]