Ad
  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    How fast exactly the solution should be? Because I just went from O(n^2) to O(n), and it's still too slow. It didn't pass even one test more, than the initial O(n^2). I don't really know what I could improve, since O(1) is impossible.