+ 1

Why Test Case #4 failed in 2D Map task? Content of task and my solution in the description.

You're given a representation of a 5x5 2D map, and if you can only move left, right, up, or down, determine how many moves you would have to make to get between two points on the map. Task: Determine the total number of moves that are needed between two points on a map. The points that you move between are marked with a P and the spaces in between are marked with X. Input Format: A string that represents the 2D space starting at the top left. Each level from top to bottom is separated by a comma. Output Format: An integer that represents the total number of moves that you had to make. Sample Input: XPXXX,XXXXX,XXXXX,XXXPX,XXXXX Sample Output: 5 https://code.sololearn.com/c6Jzza3GstrQ/?ref=app

27th Jun 2023, 8:10 AM
Monika Izydorczyk
Monika Izydorczyk - avatar
2 Antworten
0
Have you tested it with a combination where P is represented twice in a row in all the rows? Especially with that task, it's actually quite easy to find out why it fails, and you don't have to create 100 test combinations to find out.
27th Jun 2023, 2:53 PM
Jan
Jan - avatar
0
I've already fixed the problem. Thanks for your advice.
27th Jun 2023, 4:03 PM
Monika Izydorczyk
Monika Izydorczyk - avatar