A friend ran into this for her solution in javascript, and the drastic speed up was replacing the javascript object with a `Map` object.<p><pre><code> const seen = new Map()
</code></pre>
with `seen.set` and `seen.get` replacing `[]` runs the code in 5s on node on my machine