Ad
  • Custom User Avatar

    What would be the optimal solution?

  • Custom User Avatar

    I believe that by using includes, the code will have to check the entirety of b array for each the value of array a, resulting in time complexity of O(n * m)

  • Custom User Avatar

    please can you explain more about this? and what would be the most performant solution in your opinion ?

  • Custom User Avatar

    If you have ever written an algorithm that solves the towers of hanoi, you can fairly easily come up with the oneliner formula.

    Granted, if you have never written a solver for the towers of hanoi before, this task becomes harder, as you now also have to solve the game, rather than merely determining the number of steps your solver takes.