<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Dfs on Yu-Cheng's Notes</title><link>https://linkingmon.github.io/blog/tags/dfs/</link><description>Recent content in Dfs on Yu-Cheng's Notes</description><generator>Hugo -- 0.166.0</generator><language>en-us</language><lastBuildDate>Sat, 08 Mar 2025 00:00:00 +0000</lastBuildDate><atom:link href="https://linkingmon.github.io/blog/tags/dfs/index.xml" rel="self" type="application/rss+xml"/><item><title>LC 1306 - Jump Game III</title><link>https://linkingmon.github.io/blog/coding/lc-1306/</link><pubDate>Sat, 08 Mar 2025 00:00:00 +0000</pubDate><guid>https://linkingmon.github.io/blog/coding/lc-1306/</guid><description>&lt;p&gt;[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.&lt;/p&gt;
&lt;p&gt;At the beginning I wasn’t very sure how to estimate the complexity of this problem. It feels like it should be &lt;code&gt;O(n)&lt;/code&gt;. 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 &lt;code&gt;O(n)&lt;/code&gt;.&lt;/p&gt;</description></item></channel></rss>