c++ Solution
\nint reinitializePermutation(int n) {\n        int k=n/2;\n        string str="";\n        for(int i=0;i<n;i++)\n            str+=to_string(i);\n        int co
\nint reinitializePermutation(int n) {\n        int k=n/2;\n        string str="";\n        for(int i=0;i<n;i++)\n            str+=to_string(i);\n        int count=0;\n        string as=str;\n        while(1){\n            count++;\n            string s="";\n            for(int i=0;i<n;i++){\n                if(i%2==0){\n                    s+=as[i/2];\n                }\n                else if(i%2==1){\n                    int q=k+(i-1)/2;\n                    s+=as[q];\n                }\n            }\n            int res= str.compare(s);\n            if (res == 0)\n                break;\n            else{\n                as=s;\n            }\n        }\n        return count;\n    }
[]