+ 3

Why always shows same output

Coach challenges https://code.sololearn.com/cdExYZHQE5zF/?ref=app

30th Jan 2020, 5:06 PM
Samarendra Singh
Samarendra Singh - avatar
7 Respostas
+ 5
Few changes, I copypaste only that parts. //initialize flag to 0 int flag=0; ... for(int i=0;i<l;i++)//comparing { // look only after each i, then you don't need the continue part for(int j=i+1;j<l;j++) { if (str[i]==str[j]) { // only if repetition set to true flag=1; } } } if (flag) // flag should be true if duplicate printf("Deja Vu"); else printf("Unique");
30th Jan 2020, 5:15 PM
HonFu
HonFu - avatar
+ 4
Yes, sorry, I forgot to mention that I changed that - i or j <l!
30th Jan 2020, 5:18 PM
HonFu
HonFu - avatar
+ 1
~ swim ~ thanks I don't see that <=1
30th Jan 2020, 5:19 PM
Samarendra Singh
Samarendra Singh - avatar
+ 1
HonFu thank yoy
30th Jan 2020, 5:29 PM
Samarendra Singh
Samarendra Singh - avatar
0
HonFu can you plz check this
30th Jan 2020, 5:07 PM
Samarendra Singh
Samarendra Singh - avatar
0
HonFu 😭that flag value
30th Jan 2020, 5:21 PM
Samarendra Singh
Samarendra Singh - avatar