(99+) If worried about Time Limit Exceeded... [Contest Strategy] - LeetCode Discuss
There are only 15 possible inputs, so if you're worried about your solution being too slow or if your solution is too slow, you can just precompute all answers and submit an O(1) solution. If your precomputation is so slow that it takes minutes, you can even let it run in the background while you're solving the next problem(s). Remember that your contest ranking doesn't depend on the sum of your problem times but on the largest one.
Read full article from (99+) If worried about Time Limit Exceeded... [Contest Strategy] - LeetCode Discuss
No comments:
Post a Comment