I cannot understand the two for loops used in the end,rrs.substring(0,i)+ch+rrs.substring…will make string of length 3 when only c is passed as a string, how it will come bc,cb???
Permutation in recursion
This concept is really very simple. Please dry run it on paper for sample test case. You’ll easily understand that.