Dejavuu | Sololearn: Learn to code for FREE!

-1

Dejavuu

Anyone with the idea of how to solve the Dejavuu problem? Kindly assist

9/24/2021 4:19:13 PM

Michael Owen

10 Answers

New Answer

+2

rupali Your code checks the characters are serial, here one of your code lines if(a[i] == a[i+1]) // this line checks just two characters in order. I mean, if you enter this string "gkhgkh" it says "Unique" but it must be "Deja Vu". If I'm wrong, said sth incorrect, I'm really sorry. But I told the reason.

+1

Michael Owen Kindly share your attempt, so we can help you :)

+1

#include <iostream> #include <string.h> using namespace std; int main() { char a[20]; cin>>a; int k; if (k=strlen(a)){ if(a[k]==a[k]){ cout<<"Deja Vu"<<endl; } else{ cout<<"Unique"; } } return 0; }

+1

Michael Owen https://code.sololearn.com/cuazv2xalIEG/?ref=app

+1

Thank you

+1

rupali Okay, I see. Thanks for understanding. Happy coding!

0

Michael Owen Your code always prints "Deja Vu". Cause you compare the same element with itself. Check your code. Happy coding!

0

rupali Your code always prints "Unique". Cause if the characters in the given string are serial. Check your code. Happy coding!

0

mesarthim it's running fine...And passing all the test cases...Will you please describe the issue a little bit more? :|

0

mesarthim It's all right, to get correct answer according to your input we can use nesting of loops, but there is no need of nesting as the challenge says.