Add second implementation. It is exponentially faster but I can't prove it also finds an optimal solution.