Ad
  • Custom User Avatar

    I assume your code already finds a solution? I don't know what approach you took but you can memoize any found solution and let your code continue search, so if it does find any other solution afterwards it throws or if it runs out of options it either returns the only solution or throws if none was found.

  • Custom User Avatar

    First one has two solutions, which should result in error, so the problem is in your code.