Java - O(1) Space - Easy to Understand
The symmetry of the swaps allows us to say that - The array is back to the original permutation when "1" is the 2nd element.\nSo track the position of the eleme
The symmetry of the swaps allows us to say that - **The array is back to the original permutation when "1" is the 2nd element.**\nSo track the position of the element `1` after each permutation. When it\'s back in 2nd position, whole array is back to initial permutation.  \n```\nclass Solution {\n    public int reinitializePermutation(int n) {\n        int temp = n/2, count = 1;\n        while(temp != 1){\n            if(temp %2==0) temp /= 2;\n            else temp = n/2 + (temp-1)/2;\n            count++;\n        }\n        return count;\n    }\n}\n```
['Java']