Function that returns true if the String contains unique characters
static bool uniqueChars ( char [ ] arr ) { Dictionary < char , int > mp = new Dictionary < char , int > ( ) ; int n = arr . Length ; for ( int i = 0 ; i < n ; i ++ ) if ( mp . ContainsKey ( arr [ i ] ) ) { mp [ arr [ i ] ] = mp [ arr [ i ] ] + 1 ; } else { mp . Add ( arr [ i ] , 1 ) ; } if ( mp . Count == arr . Length ) return true ; else return false ; }