I need to find the shortest path between two points in a maze using recursion. the maze is represented by a two-dimensional array of integers. You can walk through cells in the array if their values are different than -1. In addition, if there are some paths with the same length, the algorithm should find the path with the highest values in the array.

I thought about an algorithm that checks all the possible paths, but I need something more efficient.

Can someone please give me a pseudo code or an actual example in C? I'm really desperated and I'm running out of time

thank you very much!