LC 1306 - Jump Game III

[translate by ChatGPT] In my first attempt, I didn’t notice the possibility of an infinite loop, so I needed to maintain a visited set. At the beginning I wasn’t very sure how to estimate the complexity of this problem. It feels like it should be O(n). My reasoning was that in the worst case every element is 1, and we start searching from the end all the way to the beginning. As long as we ensure that we never visit the same index twice, the complexity stays O(n). ...

March 8, 2025 · 1 min