function permute(arr, l, r, set) {
    if (l == r) {
        set.add(arr.join(''));
    } else {
        for (let i = l; i <= r; i++) {
            swap(arr, l, i);
            permute(arr, l + 1, r, set);
            swap(arr, l, i);
        }
    }
}
/**
 * permutation function
 * @param arr array to calculate permutation for
 * @param l starting index
 * @param r end index
 */
permutation function
@param arr array to calculate permutation for
@param l starting index
@param r end index
permutation function @param arr array to calculate permutation for @param l starting index @param r end index
function permute(arr, l, r, set) {
    if (l == r) {
        set.add(arr.join(''));
    } else {
        for (let i = l; i <= r; i++) {
            swap(arr, l, i);
            permute(arr, l + 1, r, set);
            swap(arr, l, i);
        }
    }
}
function permute ( arr , l , r , set ) { if ( l == r ) { set . add ( arr . join ( '' ) ) ; } else { for ( let i = l ; i <= r ; i ++ ) { swap ( arr , l , i ) ; permute ( arr , l + 1 , r , set ) ; swap ( arr , l , i ) ; } } }
permutation function
 @param arr array to calculate permutation for
 @param l starting index
 @param r end index
permutation function @param arr array to calculate permutation for @param l starting index @param r end index