+ 1
Flowing Words
Hi, I'm having problems with the coad coach. All test cases pass except number 3. What could be wrong in my code? https://sololearn.com/compiler-playground/cID535559W0x/?ref=app
7 Réponses
+ 4
your recursive function needs to return something. Look at line 13:
https://sololearn.com/compiler-playground/cX51ikJlJo7l/?ref=app
+ 2
Anonimsus
Found 4 issues
The code has several issues that prevent it from working correctly:
Incorrect logic for checking flow:
The code checks if the last letter of the current word matches the first letter of the previous word, but it does this in reverse order (from the end of the sentence to the beginning). This leads to incorrect results.
Inefficient use of lists:
The code repeatedly converts strings to lists and back, which is unnecessary and inefficient.
Redundant checks:
The code checks if the length of the input string is not 0 or 1, but this is already implied by the condition n > 0.
Incorrect return values:
The code returns "true" or "false" as strings instead of boolean values.
+ 1
Try to use for loop
+ 1
Already tried that and it didn't work. Case number 3 should be "false" but I don't know if it outputs "true" or nothing at all
+ 1
Yes Anonimsus