This question evaluates proficiency in graph algorithms and grid-based shortest-path computation, including handling weighted cells and obstacles and familiarity with Dijkstra-style shortest-path techniques.
You are given an m×n grid with nonnegative cell costs and blocked cells marked '#'. You may move up, down, left, or right. Given start (sx, sy) and target (tx, ty), compute the minimum total cost path that avoids obstacles, or return -1 if unreachable. Implement an O(mn log mn) solution using Dijkstra’s algorithm with a priority queue, and explain how you would reconstruct the path.