Prints all distinct permutations in str [ 0. . n - 1 ]
function findPermutations ( str , index , n ) { if ( index >= n ) { document . write ( str ) ; document . write ( " " ) return ; } for ( let i = index ; i < n ; i ++ ) {