We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6007708 commit d2f3308Copy full SHA for d2f3308
1-Array-And-String/IsUnique.cpp
@@ -20,12 +20,11 @@ bool isDupUsingHashTable( string input ) {
20
return true;
21
}
22
23
- bool map[ 128 ] = { false };
24
- for( int i=0; i < input.length(); i++ ) {
25
- if( map[ input[ i ] ] == true )
26
- return true;
27
- else
28
- map[ input[ i ] ]= true;
+ for(int i=0;i<input.length();i++){
+ for(int j=i+1;j<input.length();j++){
+ if(input[i]==input[j])
+ return true;
+ }
29
30
return false;
31
0 commit comments