My first try was very close to a final solution .. however, this is a much neater solution:
https://discuss.leetcode.com/topic/69436/concise-c-o-1-solution-using-3-hash-maps-with-explanation
Lesson learnt: data structure is crucial. And, if some logic is getting too complex, there must be sth wrong.
时间: 2024-11-02 23:32:01