0

Why doesn't it work?

Please look at this code. https://code.sololearn.com/c76PwSGvP2LX/?ref=app

17th Dec 2018, 4:46 PM
C. Scheler
C. Scheler - avatar
1 Answer
+ 7
issue with line 11: nodupl_1 != nodupl_2 When comparing strings, you should use the equals() method for comparison. So in your case it should be !nodupl_1.equals(nodupl_2). However, there is still an issue with your logic of removing duplicate letters. You are only comparing sequentially. Your code won't work if the duplicate letter is not found one after the other. (e.g. "aartya" = based on your logic the result will be "artya" although answer should be "arty")
17th Dec 2018, 6:56 PM
Lambda_Driver
Lambda_Driver - avatar