Ad
  • Custom User Avatar

    Mine timed out when I tried something similar lol
    Try a += 9 for a constant 9x speedup -- any number is always a multiple of 9 away from other numbers shuffled from the same set of digits.

  • Custom User Avatar

    Couple of things to point out:

    1. The "and" isn't necessary to remove, because you already check if w in dic and it is not in dic.
    2. You can replace hyphens with spaces in the input string to greatly cut down the size of the lookup table.
  • Custom User Avatar

    This seems like a great solution in terms of performance, but the variable naming and lack of functions leaves it very difficult to read.

  • Custom User Avatar

    I have got my time for the sample tests down to ~1500ms, but I time out on the non-sample tests, apparently without passing a single one. Is 1500ms in the practice run too slow, or could the tests be hitting some pathological case that my code does not handle well? What kind of times are other people getting for the samples?

    edit: Turns out I was very close. Just needed a small amount of tweaking and the full test battery solved in ~9s