Unique Paths III

Given a grid with start 1, end 2, empty cells 0, and obstacles -1, count the number of paths from start to end that visit every empty cell exactly once. Moves are limited to the four cardinal directions, and cells cannot be revisited.

Examples
Input: [[1,0,0,0],[0,0,0,0],[0,0,2,-1]]
Output: 2
Hints

Unique Paths III

Given a grid with start `1`, end `2`, empty cells `0`, and obstacles `-1`, count the number of paths from start to end that visit every empty cell exactly once. Moves are limited to the four cardinal directions, and cells cannot be revisited.