Bob and Alice have teamed up on a game show. After winning the first round, they now have access to a maze with hidden gold. If Bob can collect all the gold coins and deliver them to Alice’s position, they can split the gold. Bob can move horizontally or vertically as long as he stays in the maze, and the cell is not blocked. The maze is represented by an n x m array. Each cell has a value, where 0 is open, 1 is blocked, and 2 is open with a gold coin. Bob starts at the top left in cell in (row, column) = (0, 0). Alice’s position is given by (x,y). Determine the.shortest path Bob can follow to collect all gold coins and deliver them to Alice. If Bob can’t collect and give all the gold coins, return -1.
0<=no of gold coins <=10
1 <= x < n
1 <=y < m
Can anyone help me come up with an algorithm?