Shortest path is a common problem with an easy solution(BFS or DFS). But I am thinking of a shortest path algorithm but instead of the sum of the vertices, I want the product of the vertices and the weight between two vertices could be < 0. For example:
Given a 2d array represented a uni-directional graph where array[i] = [u,v,w], where u is connected to v (u and v nodes number) and w (-1000 < w < 1000) is the weight of the u->v.
Given "n" the number of nodes
Can you implement an algorithm to find the minimum product weight from 0 to n-1??
Example [[0,1,3],[0,2,1],[1,2,-1]], n=3
Result: 3*(-1) = -3