Minimax path problem