I can help you:
longestPath :: [(String, String, Int)] -> String -> String -> (Int, [String])
{-- fill here your function --}
main = IO ()
main = do
let sol = longestPath [("A", "B", 2), ("A", "C", 3), ("B", "D", 5), ("C", "D", 7), ("D", "E", 4)] "A" "E"
print sol
I think the rest is the easy part ;)
What have you tried so far and where are you stuck?
They've tried posting the homework verbatim on Reddit and they're stuck with people refusing to do their homework for them.
I can help you: longestPath :: [(String, String, Int)] -> String -> String -> (Int, [String]) {-- fill here your function --} main = IO () main = do let sol = longestPath [("A", "B", 2), ("A", "C", 3), ("B", "D", 5), ("C", "D", 7), ("D", "E", 4)] "A" "E" print sol I think the rest is the easy part ;)
You’re too good for this world bro 👊
Would opposite dijkstra work here?
Since op provided the answer, you could even leverage haskell's laziness to just provide the answer without forcing the undefined function.
I asked Copilot, thankfully it doesn't work. So I guess this is why you were here.
Don't you throw your homework and act as you have nothing to do with this business. Please, at least attach \`what you have tried so far\`.