TLE reason -- combine one string from multi-string, maybe this is your problem,too

  • 0

    which of the following statements will not TLE?

    1. try_word = cur[:i] + e + cur[i+1:]

    2. try_word = '%s%s%s'%(cur[:i], e, cur[i+1:])

    3. try_word = ''.join([cur[:i], e, cur[i+1:]])

    the answer is the first one, I make some test. There are some

    a. when strnum < 4: 1. is the fastest

    b. when strnum > 4: 3. is the fastest

    c. when strnum > 9, 1. is the slowest

    d. format can never be the best choise to combine string simply

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.