The Pathfinder Challenges: Part 1 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 10

The Pathfinder Challenges: Part 1

Warm up You are given a multi line string of integers representing a square grid. Every digit corresponds to a tile and signifies how long it takes to traverse this tile. If it's a zero, this tile cannot be traversed. You can move down and right. Your task is to write a function, which will return the time it takes to traverse the fastest path from the top left to the bottom right corner or -1, if there is no such path. The start and end point can be assumed to be traversible.

16th May 2017, 4:49 AM
Tob
Tob - avatar
2 Answers
16th May 2017, 7:00 AM
Tamás Barta
Tamás Barta - avatar
+ 5
Sample inputs: 12345 98099 02211 returns 17 1110 1101 returns -1 32284713 46350756 38570719 returns 42 Sample solution: https://code.sololearn.com/cBld2iG7YPKa
15th May 2017, 11:50 PM
Tob
Tob - avatar