<?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>Medium on hungln</title><link>https://hungle45.github.io/blog/tags/medium/</link><description>Recent content in Medium on hungln</description><generator>Hugo -- 0.145.0</generator><language>en-us</language><lastBuildDate>Sat, 14 Feb 2026 16:22:09 +0700</lastBuildDate><atom:link href="https://hungle45.github.io/blog/tags/medium/index.xml" rel="self" type="application/rss+xml"/><item><title>Leetcode 799: Champagne Tower</title><link>https://hungle45.github.io/blog/on/leetcode_799_champagne_tower/</link><pubDate>Sat, 14 Feb 2026 16:22:09 +0700</pubDate><guid>https://hungle45.github.io/blog/on/leetcode_799_champagne_tower/</guid><description>&lt;a href="https://leetcode.com/problems/champagne-tower/" target="_blank" rel="noopener noreferrer" class="leetcode-card">
&lt;div class="leetcode-card-header">
&lt;div class="leetcode-card-icon">&lt;svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" stroke="none" stroke-width="2"
stroke-linecap="round" stroke-linejoin="round">
&lt;path
d="M13.483 0a1.374 1.374 0 0 0-.961.438L7.116 6.226l-3.854 4.126a5.266 5.266 0 0 0-1.209 2.104 5.35 5.35 0 0 0-.125.513 5.527 5.527 0 0 0 .062 2.362 5.83 5.83 0 0 0 .349 1.017 5.938 5.938 0 0 0 1.271 1.818l4.277 4.193.039.038c2.248 2.165 5.852 2.133 8.063-.074l2.396-2.392c.54-.54.54-1.414.003-1.955a1.378 1.378 0 0 0-1.951-.003l-2.396 2.392a3.021 3.021 0 0 1-4.205.038l-.02-.019-4.276-4.193c-.652-.64-.972-1.469-.948-2.263a2.68 2.68 0 0 1 .066-.523 2.545 2.545 0 0 1 .619-1.164L9.13 8.114c1.058-1.134 3.204-1.27 4.43-.278l3.501 2.831c.593.48 1.461.387 1.94-.207a1.384 1.384 0 0 0-.207-1.943l-3.5-2.831c-.8-.647-1.766-1.045-2.774-1.202l2.015-2.158A1.384 1.384 0 0 0 13.483 0zm-2.866 12.815a1.38 1.38 0 0 0-1.38 1.382 1.38 1.38 0 0 0 1.38 1.382H20.79a1.38 1.38 0 0 0 1.38-1.382 1.38 1.38 0 0 0-1.38-1.382z" />
&lt;/svg>&lt;/div>
&lt;div class="leetcode-card-content">&lt;span class="leetcode-card-id">#799&lt;/span>&lt;span class="leetcode-card-name">Champagne Tower&lt;/span>
&lt;span class="leetcode-card-difficulty difficulty-medium">Medium&lt;/span>
&lt;span class="leetcode-card-arrow">→&lt;/span>
&lt;/div>
&lt;/div>
&lt;/a>
&lt;h3 id="approach-simulation">Approach: Simulation&lt;/h3>
&lt;h4 id="intuition">Intuition&lt;/h4>
&lt;p>In this problem, instead of simulating the final amount of champagne in each glass, we focus on the amount of champagne that flows through each glass.
Any amount exceeding one unit is considered excess and is split equally between the two glasses in the row below (bottom-left and bottom-right).
For example, if 10 units are poured into the top cup, 1 unit is retained and the remaining 9 units are distributed—4.5 units to each glass directly below.&lt;/p></description></item><item><title>Leetcode 3713: Longest Balanced Substring I</title><link>https://hungle45.github.io/blog/on/leetcode_3713_longest_balanced_substring_i/</link><pubDate>Thu, 12 Feb 2026 10:27:07 +0700</pubDate><guid>https://hungle45.github.io/blog/on/leetcode_3713_longest_balanced_substring_i/</guid><description>&lt;a href="https://leetcode.com/problems/longest-balanced-substring-i" target="_blank" rel="noopener noreferrer" class="leetcode-card">
&lt;div class="leetcode-card-header">
&lt;div class="leetcode-card-icon">&lt;svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" stroke="none" stroke-width="2"
stroke-linecap="round" stroke-linejoin="round">
&lt;path
d="M13.483 0a1.374 1.374 0 0 0-.961.438L7.116 6.226l-3.854 4.126a5.266 5.266 0 0 0-1.209 2.104 5.35 5.35 0 0 0-.125.513 5.527 5.527 0 0 0 .062 2.362 5.83 5.83 0 0 0 .349 1.017 5.938 5.938 0 0 0 1.271 1.818l4.277 4.193.039.038c2.248 2.165 5.852 2.133 8.063-.074l2.396-2.392c.54-.54.54-1.414.003-1.955a1.378 1.378 0 0 0-1.951-.003l-2.396 2.392a3.021 3.021 0 0 1-4.205.038l-.02-.019-4.276-4.193c-.652-.64-.972-1.469-.948-2.263a2.68 2.68 0 0 1 .066-.523 2.545 2.545 0 0 1 .619-1.164L9.13 8.114c1.058-1.134 3.204-1.27 4.43-.278l3.501 2.831c.593.48 1.461.387 1.94-.207a1.384 1.384 0 0 0-.207-1.943l-3.5-2.831c-.8-.647-1.766-1.045-2.774-1.202l2.015-2.158A1.384 1.384 0 0 0 13.483 0zm-2.866 12.815a1.38 1.38 0 0 0-1.38 1.382 1.38 1.38 0 0 0 1.38 1.382H20.79a1.38 1.38 0 0 0 1.38-1.382 1.38 1.38 0 0 0-1.38-1.382z" />
&lt;/svg>&lt;/div>
&lt;div class="leetcode-card-content">&lt;span class="leetcode-card-id">#3713&lt;/span>&lt;span class="leetcode-card-name">Longest Balanced Substring I&lt;/span>
&lt;span class="leetcode-card-difficulty difficulty-medium">Medium&lt;/span>
&lt;span class="leetcode-card-arrow">→&lt;/span>
&lt;/div>
&lt;/div>
&lt;/a>
&lt;h3 id="approach-brute-force-enumeration--frequency-counting">Approach: Brute-Force Enumeration + Frequency Counting&lt;/h3>
&lt;h4 id="intuition">Intuition&lt;/h4>
&lt;p>The goal is to indentify the longest balanced substring within string &lt;code>s&lt;/code>. A substring is called &lt;strong>balanced&lt;/strong> if all the distinct characters in the substring appears the same number of times. My approach exhaustively explores all possible substrings to track the maximum length encountered.&lt;/p></description></item><item><title>Leetcode 1382: Balance a Binary Search Tree</title><link>https://hungle45.github.io/blog/on/leetcode_1382_balance_a_binary_search_tree/</link><pubDate>Mon, 09 Feb 2026 11:24:53 +0700</pubDate><guid>https://hungle45.github.io/blog/on/leetcode_1382_balance_a_binary_search_tree/</guid><description>&lt;a href="https://leetcode.com/problems/balance-a-binary-search-tree/" target="_blank" rel="noopener noreferrer" class="leetcode-card">
&lt;div class="leetcode-card-header">
&lt;div class="leetcode-card-icon">&lt;svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" stroke="none" stroke-width="2"
stroke-linecap="round" stroke-linejoin="round">
&lt;path
d="M13.483 0a1.374 1.374 0 0 0-.961.438L7.116 6.226l-3.854 4.126a5.266 5.266 0 0 0-1.209 2.104 5.35 5.35 0 0 0-.125.513 5.527 5.527 0 0 0 .062 2.362 5.83 5.83 0 0 0 .349 1.017 5.938 5.938 0 0 0 1.271 1.818l4.277 4.193.039.038c2.248 2.165 5.852 2.133 8.063-.074l2.396-2.392c.54-.54.54-1.414.003-1.955a1.378 1.378 0 0 0-1.951-.003l-2.396 2.392a3.021 3.021 0 0 1-4.205.038l-.02-.019-4.276-4.193c-.652-.64-.972-1.469-.948-2.263a2.68 2.68 0 0 1 .066-.523 2.545 2.545 0 0 1 .619-1.164L9.13 8.114c1.058-1.134 3.204-1.27 4.43-.278l3.501 2.831c.593.48 1.461.387 1.94-.207a1.384 1.384 0 0 0-.207-1.943l-3.5-2.831c-.8-.647-1.766-1.045-2.774-1.202l2.015-2.158A1.384 1.384 0 0 0 13.483 0zm-2.866 12.815a1.38 1.38 0 0 0-1.38 1.382 1.38 1.38 0 0 0 1.38 1.382H20.79a1.38 1.38 0 0 0 1.38-1.382 1.38 1.38 0 0 0-1.38-1.382z" />
&lt;/svg>&lt;/div>
&lt;div class="leetcode-card-content">&lt;span class="leetcode-card-id">#1382&lt;/span>&lt;span class="leetcode-card-name">Balance a Binary Search Tree&lt;/span>
&lt;span class="leetcode-card-difficulty difficulty-medium">Medium&lt;/span>
&lt;span class="leetcode-card-arrow">→&lt;/span>
&lt;/div>
&lt;/div>
&lt;/a>
&lt;h3 id="overview">Overview&lt;/h3>
&lt;p>The problem asks us to balance a binary search tree (BST) such that the height of the tree is minimized. This means that for every node in the tree, the height of its left subtree and the height of its right subtree should differ by at most 1.&lt;/p></description></item></channel></rss>