TLE for DP O(n^2) solutions in Python


  • 0
    M

    So I think I finally understood logic of test creators.
    Even if you write a classical DP or memorization solution for this one you will timeout on latest tests.
    I think they consider it edge cases. Because if you add one simple line it will pass! OMG.
    I have leet code for this. Instead of solving problems I spend hours optimizing the constants.

    if s == s[::-1]: return s


Log in to reply
 

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