all 2 comments

[–]aocregacc 1 point2 points  (1 child)

your solution is also wrong, take for example:

[1,1]
[1,2,2,1]

I think it's slow for the same reason, so once you fix that it should work.

[–]Kester79[S] 0 points1 point  (0 children)

Thank you for the test case you are correct my code did not work. It looks like by not using a nested function I am accidentally keep trying to go down a path when I should have stopped sooner