C++ 100% faster and 4 lines solution
x is for tracking the position of 1 in the entire array and ans is the number of steps\n\nclass Solution {\npublic:\n    int reinitializePermutation(int n) {\n 
x is for tracking the position of 1 in the entire array and ans is the number of steps\n```\nclass Solution {\npublic:\n    int reinitializePermutation(int n) {\n        int x = 2, ans = 1;\n        while((x-1)%(n-1)){\n            ans++;\n            x = (2*x-1)%(n-1) + 1;\n        }\n        return ans;\n    }\n};\n```
[]