Your question is Implement Algorithm Without Packages. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
A workflow tool supporting MSK-IMPACT review represents navigation options as a grid. Find a route from S to T that does not exceed a maximum cumulative risk and minimizes total risk. If multiple routes have the same risk, choose the one with fewer moves. If a tie remains, choose the lexicographically smallest move sequence under D < L < R < U.
You may move one cell at a time in four directions. # cells are blocked. Digit cells have risk values from 1 to 9; entering S or T adds zero risk. Return the move sequence, or "" when no valid route exists. Implement the algorithm without importing packages.
Implement minimum_risk_route(grid, max_risk), where grid is a non-empty list of equal-length strings containing exactly one S and one T, and max_risk is a non-negative integer. Return a string containing only D, L, R, and U.
def minimum_risk_route(grid, max_risk):