Ad
  • Default User Avatar

    You are thinking as of [row][column] and the solution is [column][row]

  • Default User Avatar

    Managed to pass all tests except the last one wich exceeds time.

    My solution creates the array and then it searches the array in O(n) but creating the array is a O(n^2).

    I've seen the other discussions and you gave a hint to check "one step ahead", that the algorithm has to be O(log(n)) and that there can't be a data structure big enough to hold the seq[n] info.

    I'm thinking maybe there is no need to create any data structure at all?

    Maybe its a recursion of very few steps?

    Can you shine a bit of light on me? Thanks, great problem, it's kept me thinking on it these last days