LeetCode weekly contest 132
This contest was not hard, but the code was not easy to implement. It was not easy to write bug-free in one pass. What it tested was using a programming language to handle complex logic and various unexpected cases. For example, in the third problem, when the previous dp is 0, the length should be updated to 2; otherwise it should be dp + 1. In the fourth problem, when looking for delimiters under various cases, how should it be handled if none is found?
| Rank | Name | Score | Finish Time | Q1 (4) | Q2 (5) | Q3 (5) | Q4 (5) |
|---|---|---|---|---|---|---|---|
| 388 / 4765 | YoungForest | 24 | 1:21:20 | 0:15:54 | 0:30:16 | 0:38:05 | 1:21:20 |
| It probably required finishing within about 1 hour to enter the top 200. |
For the fourth problem, I spent quite a lot of time debugging because of some boundary conditions. I analyzed why it took so long. It is still because I have not written enough code and am not sensitive enough to boundary conditions for variable updates. For example, when string::find does not find a result, how should the other coordinates be updated? I made the mistake that when nothing was found, it returned npos(-1), and current_find_index should have been equal to end, instead of continuing to add the delimiter length on top of -1.