Standard Bellman-Ford runs iterations to find shortest paths with at most edges. Here, you run iterations because at most stops means at most flights. Use two distance arrays: (current layer) and prev (previous layer). In each iteration, relax edges using prev and write results to .
Copy to prev at the start of each iteration. This prevents using the same layer's updates within one iteration, which would allow longer paths than intended. Each iteration extends paths by exactly one edge.