Function that returns true if the String contains unique characters
static boolean uniqueChars ( char [ ] arr ) { HashMap < Character , Integer > mp = new HashMap < Character , Integer > ( ) ; int n = arr . length ; for ( int i = 0 ; i < n ; i ++ ) if ( mp . containsKey ( arr [ i ] ) ) { mp . put ( arr [ i ] , mp . get ( arr [ i ] ) + 1 ) ; } else { mp . put ( arr [ i ] , 1 ) ; } if ( mp . size ( ) == arr . length ) return true ; else return false ; }