The input is a DAG, so a visited set is not merely unnecessary here — it is wrong. It silently drops every path that would have gone through a node some earlier path already used. Flip the toggle and watch the answers disappear one at a time.
path.removeLast().