[Python3] A* - Simple
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution:\n    def minPushBox(self, grid: List[List[str]]) -> int:\n        m, n = len(grid), len(grid[0])\n        for r in range(m):\n            for c in range(n):\n                if grid[r][c] == "T": target = (r, c)\n                if grid[r][c] == "B": start_box = (r, c)\n                if grid[r][c] == "S": start_person = (r, c)\n        \n        def heuristic(box: tuple) -> int:\n            return abs(target[0] - box[0]) + abs(target[1] - box[1])\n        \n        def out_bounds(location: tuple) -> bool:\n            r, c = location\n            return not (0 <= r < m and 0 <= c < n and grid[r][c] != "#")\n        \n        pq = [(heuristic(start_box), 0, start_person, start_box)]\n        visited = set()\n        while pq:\n            _, moves, person, box = heapq.heappop(pq)\n            if box == target: return moves\n            if (person, box) in visited: continue\n            visited.add((person, box))\n            for dr, dc in [(0, 1), (1, 0), (-1, 0), (0, -1)]:\n                new_person = (person[0] + dr, person[1] + dc)\n                if out_bounds(new_person): continue\n                if new_person == box:\n                    new_box = (box[0] + dr, box[1] + dc)\n                    if out_bounds(new_box): continue\n                    heapq.heappush(pq, (heuristic(new_box) + moves + 1, moves + 1, new_person, new_box))\n                else: heapq.heappush(pq, (heuristic(box) + moves, moves, new_person, box))\n        return -1\n```
['Breadth-First Search', 'Heap (Priority Queue)', 'Python3']