0

Why is this program a mistake [4]

When challenging code coach (how far?), i can't satisfy the test condition 3 and 4. Can anyone give me advice how it's done? Btw here is my code so far: https://sololearn.com/compiler-playground/c4QgbDta5Uca/?ref=app

29th Aug 2024, 9:43 AM
Celvien Kurniawan
Celvien Kurniawan - avatar
8 Antworten
+ 3
The first problem that happened is the missing } 😅 Easily fixed. I tried 2 different inputs and you tell me what's wrong with your code. Input 1: HBBP Input 2: PBBH
29th Aug 2024, 12:02 PM
Ausgrindtube
Ausgrindtube - avatar
+ 4
the challenge is from the `code coach` section: https://www.sololearn.com/coach/72?ref=app
29th Aug 2024, 3:43 PM
Lothar
Lothar - avatar
+ 3
What am i supposed to do in this challenge, how am i supposed to help you if i don't know the challenge.
29th Aug 2024, 12:11 PM
SoloProg
SoloProg - avatar
+ 2
You'll get it for sure. Happy to help when I can. Enjoy your coding journey!
30th Aug 2024, 6:45 PM
Ausgrindtube
Ausgrindtube - avatar
+ 2
The } is missing
31st Aug 2024, 6:50 AM
Vaibhavi Dubey
Vaibhavi Dubey - avatar
+ 1
I know the missing } was a mistake. All good there. Have you tested and viewed my 2 inputs?
30th Aug 2024, 6:11 AM
Ausgrindtube
Ausgrindtube - avatar
+ 1
Oh. The second input gives value -1 in my code. I think the culprit is the break function. thank a lot for helping me debug this code.
30th Aug 2024, 8:17 AM
Celvien Kurniawan
Celvien Kurniawan - avatar
0
Ausgrindtube oh, about the missing ' }' its my mistake. What i mean in this post is the logical error in my program. Because in the code coach test run, the 3rd and 4th test is always give wrong result with my mentioned code. How should i do to make this right?
30th Aug 2024, 5:11 AM
Celvien Kurniawan
Celvien Kurniawan - avatar