Ad
  • Custom User Avatar

    Note that this has time complexity O(N^2) while it's possible to achieve O(N).

  • Custom User Avatar

    Never mind, the piece of optimisation I failed to figure out was checking for a set rather than the entire string. My bad.

  • Custom User Avatar

    I continuously timed out with this exact solution...

  • Custom User Avatar

    I'm new to programming and if I'm wrong please someone correct me!

    I believe it's because it's being considered to be null terminated strings.
    Therefore the last character of these strings are '\0', but in a empty string this would be the only character
    and when we compare it with a string that isn't empty it would return true since '\0' is present in both.

    But as far as I understand it isn't something that will be printed in the screen, just something that will be
    considered by the machine.

  • Custom User Avatar

    How could this pass the test while my first try failed?
    This should report an error with empty input of s2,
    when you try scramble('r',''), this code return True while it should be False.