Say, you have string "12345". Say, i = 4 (that is, tf.charAt(i) == '5').
Now look at the code that checks all the substring:
for (int k=0;k<i;k++)
if(tf.charAt(i)!=tf.charAt(k))...
Type: Posts; User: angstrem
Say, you have string "12345". Say, i = 4 (that is, tf.charAt(i) == '5').
Now look at the code that checks all the substring:
for (int k=0;k<i;k++)
if(tf.charAt(i)!=tf.charAt(k))...
Why not to follow the following algorithm:
1. For a given character, check all the substring before this character
2. If the substring does not contain this character - print it
3. Repeat (1) -...
What happens if i + z > tf.length?