0
I really don't know what am I missing in my code and how to fix it. Please help me fix it!
It's a problem in the community section named "2D Map". Here's my code:----------> https://code.sololearn.com/crOw323MPxvz/?ref=app
2 Respuestas
+ 5
Vaibhav Pandey,
not so easy to understand how the logic of the code is working. so i did some tests with various inputs, and i found a constellation of the input, where the result is not correct.
when using this input: 'XXXXX,XXXXX,XXXXX,XXXXP,XXXXP'. the result should be 1, because it is just one step downwards. your current code outputs 0.
it looks like the result is not correct, if "P" has the same position / index in the substring.
may be this can help you to find the bug.
+ 1
Lothar Thank you bro I just added a new line in the first for loop and the bug is fixed.