Iterating over dic ends with TLE while list doesn't?


  • 0
    J

    When I use a dictionary maintaining all the numbers added and iterate over the dic finding the sum, time limit exceeded. After I use an extra list to maintain the distinct numbers added and iterate over the list, however, the solution is accepted. Anyone knows why?


Log in to reply
 

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