Back
Close
  • 58

What will I learn?

Pathfinding2D array

Statement

 Goal

The 12 year old child has lost his mother and now he wants to meet his mother.Somehow child navigated to his mother but he wanna know exact shortest distance and in order to help him you have to tell him exact shortest distance .each block =10km
Input
map 10*10 first ten lines input string row only consist of '.' means road where child can move,'#'-means wall where he can't move,'M'-position of mother,'C'-position of child.
NOTE-child can't move diagonally.
Output
one line with the shortest ditance which child have to travel in order to reach his mother
NOTE-Get ready for Episode 2.
Constraints
length of each row will be 10 and consist of only:-
'.'-Road where child can move(empty space)
'#'-wall child can't move
'M'-position of his mother
'C'-position of child
There will always be a solution
Example
Input
..........
M....C....
..........
..........
..........
..........
..........
..........
..........
..........
Output
50km
Solve it

A higher resolution is required to access the IDE

codingame x discord
Join the CodinGame community on Discord to chat about puzzle contributions, challenges, streams, blog articles - all that good stuff!
JOIN US ON DISCORD
Online Participants