Returns true if str [ curr ] does not matches with any of the characters after str [ start ]
function shouldSwap ( str , start , curr ) { for ( let i = start ; i < curr ; i ++ ) { if ( str [ i ] == str [ curr ] ) { return false ; } } return true ; }