<?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>LeetCode 213 on Jeanphilo Blog</title><link>https://shio-chan-dev.github.io/jeanblog/tags/leetcode-213/</link><description>Recent content in LeetCode 213 on Jeanphilo Blog</description><generator>Hugo -- 0.166.0</generator><language>en-us</language><lastBuildDate>Tue, 22 Sep 2026 10:00:00 +0800</lastBuildDate><atom:link href="https://shio-chan-dev.github.io/jeanblog/tags/leetcode-213/index.xml" rel="self" type="application/rss+xml"/><item><title>LeetCode 213: House Robber II, Splitting the Circle into Two Linear Problems</title><link>https://shio-chan-dev.github.io/jeanblog/alg/leetcode/hot100/213-house-robber-ii/</link><pubDate>Tue, 22 Sep 2026 10:00:00 +0800</pubDate><guid>https://shio-chan-dev.github.io/jeanblog/alg/leetcode/hot100/213-house-robber-ii/</guid><description>&lt;h2 id="problem"&gt;Problem&lt;/h2&gt;
&lt;h3 id="input-and-output"&gt;Input and Output&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Input: an integer array &lt;code&gt;nums&lt;/code&gt;, where &lt;code&gt;nums[i]&lt;/code&gt; is the money in the &lt;code&gt;i&lt;/code&gt;-th house.&lt;/li&gt;
&lt;li&gt;The houses form a circle. Adjacent houses cannot both be robbed, so houses &lt;code&gt;0&lt;/code&gt; and &lt;code&gt;n - 1&lt;/code&gt; cannot both be robbed either.&lt;/li&gt;
&lt;li&gt;Output: the maximum amount of money that can be robbed without triggering the alarm.&lt;/li&gt;
&lt;li&gt;Constraints: &lt;code&gt;1 &amp;lt;= nums.length &amp;lt;= 100&lt;/code&gt;, &lt;code&gt;0 &amp;lt;= nums[i] &amp;lt;= 1000&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="examples"&gt;Examples&lt;/h3&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Input: nums = [2,3,2]
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Output: 3
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Explanation: Houses 0 and 2 are adjacent around the circle, so they cannot both be robbed; rob the house containing 3.
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Input: nums = [1,2,3,1]
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Output: 4
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Explanation: We can rob indices 0 and 2, or indices 1 and 3.
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Input: nums = [1,2,3]
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Output: 3
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This tutorial uses Python only and starts with the smallest first-last conflict.&lt;/p&gt;</description></item></channel></rss>