<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Posts on Alan Zhan Blog</title>
    <link>https://alanzhan.dev/en/post/</link>
    <description>Recent content in Posts on Alan Zhan Blog</description>
    <generator>Hugo</generator>
    <language>en-us</language>
    <lastBuildDate>Sun, 12 Mar 2023 18:04:41 +0800</lastBuildDate>
    <atom:link href="https://alanzhan.dev/en/post/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Building a Private GKE Cluster with Terraform</title>
      <link>https://alanzhan.dev/en/post/2023-03-12-terraform-private-gke/</link>
      <pubDate>Sun, 12 Mar 2023 18:04:41 +0800</pubDate>
      <guid>https://alanzhan.dev/en/post/2023-03-12-terraform-private-gke/</guid>
      <description>&lt;p&gt;Let&amp;rsquo;s spend about ten minutes together — I&amp;rsquo;ll walk you through using Terraform to build a private GKE Cluster step by step!&lt;/p&gt;&#xA;&lt;h2 id=&#34;setting-up-gcp&#34;&gt;Setting Up GCP&lt;/h2&gt;&#xA;&lt;p&gt;&#xA;  &lt;img src=&#34;https://alanzhan.dev/2023-03-12-terraform-private-gke/create-service-account.jpg&#34; alt=&#34;Create Service Account and Key&#34;&gt;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h3 id=&#34;create-a-service-account&#34;&gt;Create a Service Account&lt;/h3&gt;&#xA;&lt;p&gt;First, go to the Google Cloud console and create a Service Account for Terraform to use. Follow steps 1, 2, and 3 in the diagram above. If you already have a Service Account, you can skip this step.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Mindset: The New Psychology of Success</title>
      <link>https://alanzhan.dev/en/post/2022-10-02-lifelong-growth/</link>
      <pubDate>Sun, 02 Oct 2022 20:20:53 +0800</pubDate>
      <guid>https://alanzhan.dev/en/post/2022-10-02-lifelong-growth/</guid>
      <description>&lt;h2 id=&#34;mindset-types&#34;&gt;Mindset Types&lt;/h2&gt;&#xA;&lt;p&gt;Imagine you took a course that was very important to you and that you really enjoyed. Your professor announces the midterm results, and you only scored 60. You&amp;rsquo;re very disappointed. That evening when you&amp;rsquo;re heading home, you discover you missed the last train and have to walk home. Feeling angry, you call your best friend to vent, but they don&amp;rsquo;t pick up.&lt;/p&gt;&#xA;&lt;p&gt;How would you think about this story?&lt;/p&gt;</description>
    </item>
    <item>
      <title>Kubernetes Core Component: Kubelet</title>
      <link>https://alanzhan.dev/en/post/2022-08-30-kubernetes-kubelet/</link>
      <pubDate>Tue, 30 Aug 2022 20:56:08 +0800</pubDate>
      <guid>https://alanzhan.dev/en/post/2022-08-30-kubernetes-kubelet/</guid>
      <description>&lt;h1 id=&#34;kubelet-architecture&#34;&gt;Kubelet Architecture&lt;/h1&gt;&#xA;&lt;p&gt;As shown in the kubelet internal component structure diagram below, Kubelet is composed of many internal components:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Kubelet API: Including the authenticated API on port 10250, cAdvisor API on port 4194, read-only API on port 10255, and health check API on port 10248.&lt;/li&gt;&#xA;&lt;li&gt;syncLoop: Receives Pod updates from the API or manifest directories, sends them to podWorkers for processing, extensively using channels for async request handling.&lt;/li&gt;&#xA;&lt;li&gt;Auxiliary managers: Such as cAdvisor, PLEG, Volume Manager, etc., handling work outside of syncLoop.&lt;/li&gt;&#xA;&lt;li&gt;CRI: Container Runtime Interface, responsible for communicating with container runtime shims.&lt;/li&gt;&#xA;&lt;li&gt;Container runtimes: Such as dockershim, rkt, etc.&lt;/li&gt;&#xA;&lt;li&gt;Network plugins: Currently supports CNI and kubenet.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&#xA;  &lt;img src=&#34;https://alanzhan.dev/2022-08-30-kubernetes-kubelet/architecture.png&#34; alt=&#34;kubelet architecture&#34;&gt;&#xA;&#xA;&lt;/p&gt;</description>
    </item>
    <item>
      <title>Plain English Leetcode - 25 Reverse Nodes in k-Group</title>
      <link>https://alanzhan.dev/en/post/2022-08-28-leetcode-25/</link>
      <pubDate>Sun, 28 Aug 2022 14:22:55 +0800</pubDate>
      <guid>https://alanzhan.dev/en/post/2022-08-28-leetcode-25/</guid>
      <description>&lt;h1 id=&#34;25-reverse-nodes-in-k-group&#34;&gt;25. Reverse Nodes in k-Group&lt;/h1&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://leetcode.com/problems/reverse-nodes-in-k-group/&#34;&gt;https://leetcode.com/problems/reverse-nodes-in-k-group/&lt;/a&gt;&lt;/p&gt;&#xA;&lt;h3&gt;Hard&lt;/h3&gt;&lt;hr&gt;&lt;div&gt;&lt;p&gt;Given the &lt;code&gt;head&lt;/code&gt; of a linked list, reverse the nodes of the list &lt;code&gt;k&lt;/code&gt; at a time, and return &lt;em&gt;the modified list&lt;/em&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;k&lt;/code&gt; is a positive integer and is less than or equal to the length of the linked list. If the number of nodes is not a multiple of &lt;code&gt;k&lt;/code&gt; then left-out nodes, in the end, should remain as it is.&lt;/p&gt;&#xA;&lt;p&gt;You may not alter the values in the list&#39;s nodes, only nodes themselves may be changed.&lt;/p&gt;</description>
    </item>
    <item>
      <title>The Forrest Gump Investment Method</title>
      <link>https://alanzhan.dev/en/post/2022-08-14-forrest-gump-invest/</link>
      <pubDate>Sun, 14 Aug 2022 14:41:06 +0800</pubDate>
      <guid>https://alanzhan.dev/en/post/2022-08-14-forrest-gump-invest/</guid>
      <description>&lt;p&gt;I remember about three years ago, when I was a complete stock market beginner. Right after learning about the Taiwan stock market, I jumped straight into trading. My first stock was CTBC Financial Holdings (2891) — I still remember the ticker clearly. But watching the daily ups and downs was nerve-wracking, and I eventually couldn&amp;rsquo;t take it anymore and sold. Fortunately, I made a tiny profit — enough for a lunch box — rather than losing money. That was lucky indeed. Then, by chance, I came across &amp;ldquo;The Forrest Gump Investment Method,&amp;rdquo; which launched my journey into index investing. Today, I&amp;rsquo;d like to introduce this book.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Kubernetes Core Component: Controller Manager</title>
      <link>https://alanzhan.dev/en/post/2022-07-30-kubenetes-controller-manager/</link>
      <pubDate>Sat, 30 Jul 2022 20:07:01 +0800</pubDate>
      <guid>https://alanzhan.dev/en/post/2022-07-30-kubenetes-controller-manager/</guid>
      <description>&lt;p&gt;Controller Manager is the automation control center of a Kubernetes cluster, containing over 30 controllers that manage Pod-related, network-related, storage-related operations, and more. Most controllers work similarly — each controller is a control loop responsible for watching its corresponding resources through the API server, deciding on the next action based on the object&amp;rsquo;s state, and driving it toward the desired state.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Controller Manager is the brain of the cluster and the key to keeping it running.&lt;/li&gt;&#xA;&lt;li&gt;Its role is to ensure Kubernetes follows the declarative system specification, keeping the system&amp;rsquo;s Actual State consistent with the user-defined Desired State.&lt;/li&gt;&#xA;&lt;li&gt;Controller Manager is a combination of multiple controllers. Each controller is a control loop responsible for watching its managed objects and completing configuration when objects change.&lt;/li&gt;&#xA;&lt;li&gt;Failed controller configurations typically trigger automatic retries. Through the controller&amp;rsquo;s continuous retry mechanism, the entire cluster ensures Eventual Consistency.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h1 id=&#34;controller-workflow&#34;&gt;Controller Workflow&lt;/h1&gt;&#xA;&lt;p&gt;&#xA;  &lt;img src=&#34;https://alanzhan.dev/2022-07-30-kubenetes-controller-manager/controller-flow.png&#34; alt=&#34;&#34;&gt;&#xA;&#xA;&lt;/p&gt;</description>
    </item>
    <item>
      <title>Plain English Leetcode - 70 Climbing Stairs</title>
      <link>https://alanzhan.dev/en/post/2022-07-13-leetcode-70/</link>
      <pubDate>Wed, 13 Jul 2022 22:22:58 +0800</pubDate>
      <guid>https://alanzhan.dev/en/post/2022-07-13-leetcode-70/</guid>
      <description>&lt;h1 id=&#34;70-climbing-stairs&#34;&gt;70. Climbing Stairs&lt;/h1&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://leetcode.com/problems/climbing-stairs/&#34;&gt;https://leetcode.com/problems/climbing-stairs/&lt;/a&gt;&lt;/p&gt;&#xA;&lt;h3&gt;Easy&lt;/h3&gt;&lt;hr&gt;&lt;div&gt;&lt;p&gt;You are climbing a staircase. It takes &lt;code&gt;n&lt;/code&gt; steps to reach the top.&lt;/p&gt;&#xA;&lt;p&gt;Each time you can either climb &lt;code&gt;1&lt;/code&gt; or &lt;code&gt;2&lt;/code&gt; steps. In how many distinct ways can you climb to the top?&lt;/p&gt;&#xA;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Example 1:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;strong&gt;Input:&lt;/strong&gt; n = 2&#xA;&lt;strong&gt;Output:&lt;/strong&gt; 2&#xA;&lt;strong&gt;Explanation:&lt;/strong&gt; There are two ways to climb to the top.&#xA;1. 1 step + 1 step&#xA;2. 2 steps&#xA;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;strong&gt;Example 2:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;strong&gt;Input:&lt;/strong&gt; n = 3&#xA;&lt;strong&gt;Output:&lt;/strong&gt; 3&#xA;&lt;strong&gt;Explanation:&lt;/strong&gt; There are three ways to climb to the top.&#xA;1. 1 step + 1 step + 1 step&#xA;2. 1 step + 2 steps&#xA;3. 2 steps + 1 step&#xA;&lt;/pre&gt;&#xA;&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description>
    </item>
    <item>
      <title>Kubernetes - Node Maintenance and Pod Migration</title>
      <link>https://alanzhan.dev/en/post/2022-07-10-kubernetes-cordon-drain/</link>
      <pubDate>Sun, 10 Jul 2022 18:19:11 +0800</pubDate>
      <guid>https://alanzhan.dev/en/post/2022-07-10-kubernetes-cordon-drain/</guid>
      <description>&lt;p&gt;Our company recently discovered machines on GKE with particularly low resource utilization. Those unused resources are still costing money, so we created a new Node Pool with lower and cheaper resources, then used Cordon + Drain (or manually deleted Pods) to reschedule Pods onto the new Node Pool. On GKE, simply deleting the old Node Pool would achieve the same result, but we chose the safer approach.&lt;/p&gt;&#xA;&lt;p&gt;This essentially marks a Node as unschedulable, then lets Pods migrate to the expected hosts. Let&amp;rsquo;s discuss how to safely handle node failures or upgrades.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Plain English Leetcode - 69 Sqrt(x)</title>
      <link>https://alanzhan.dev/en/post/2022-06-30-leetcode-69/</link>
      <pubDate>Thu, 30 Jun 2022 23:37:48 +0800</pubDate>
      <guid>https://alanzhan.dev/en/post/2022-06-30-leetcode-69/</guid>
      <description>&lt;h1 id=&#34;69-sqrtx&#34;&gt;69. Sqrt(x)&lt;/h1&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://leetcode.com/problems/sqrtx/&#34;&gt;https://leetcode.com/problems/sqrtx/&lt;/a&gt;&lt;/p&gt;&#xA;&lt;h3&gt;Easy&lt;/h3&gt;&lt;hr&gt;&lt;div&gt;&lt;p&gt;Given a non-negative integer &lt;code&gt;x&lt;/code&gt;,&amp;nbsp;compute and return &lt;em&gt;the square root of&lt;/em&gt; &lt;code&gt;x&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Since the return type&amp;nbsp;is an integer, the decimal digits are &lt;strong&gt;truncated&lt;/strong&gt;, and only &lt;strong&gt;the integer part&lt;/strong&gt; of the result&amp;nbsp;is returned.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Note:&amp;nbsp;&lt;/strong&gt;You are not allowed to use any built-in exponent function or operator, such as &lt;code&gt;pow(x, 0.5)&lt;/code&gt; or&amp;nbsp;&lt;code&gt;x ** 0.5&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Example 1:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;strong&gt;Input:&lt;/strong&gt; x = 4&#xA;&lt;strong&gt;Output:&lt;/strong&gt; 2&#xA;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;strong&gt;Example 2:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;strong&gt;Input:&lt;/strong&gt; x = 8&#xA;&lt;strong&gt;Output:&lt;/strong&gt; 2&#xA;&lt;strong&gt;Explanation:&lt;/strong&gt; The square root of 8 is 2.82842..., and since the decimal part is truncated, 2 is returned.&lt;/pre&gt;&#xA;&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description>
    </item>
    <item>
      <title>Plain English Leetcode - 433 Minimum Genetic Mutation</title>
      <link>https://alanzhan.dev/en/post/2022-06-28-leetcode-433/</link>
      <pubDate>Tue, 28 Jun 2022 23:55:43 +0800</pubDate>
      <guid>https://alanzhan.dev/en/post/2022-06-28-leetcode-433/</guid>
      <description>&lt;h1 id=&#34;433-minimum-genetic-mutation&#34;&gt;433. Minimum Genetic Mutation&lt;/h1&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://leetcode.com/problems/minimum-genetic-mutation/&#34;&gt;https://leetcode.com/problems/minimum-genetic-mutation/&lt;/a&gt;&lt;/p&gt;&#xA;&lt;h3&gt;Medium&lt;/h3&gt;&lt;hr&gt;&lt;div&gt;&lt;p&gt;A gene string can be represented by an 8-character long string, with choices from &lt;code&gt;&#39;A&#39;&lt;/code&gt;, &lt;code&gt;&#39;C&#39;&lt;/code&gt;, &lt;code&gt;&#39;G&#39;&lt;/code&gt;, and &lt;code&gt;&#39;T&#39;&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Suppose we need to investigate a mutation from a gene string &lt;code&gt;start&lt;/code&gt; to a gene string &lt;code&gt;end&lt;/code&gt; where one mutation is defined as one single character changed in the gene string.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&#x9;&lt;li&gt;For example, &lt;code&gt;&#34;AACCGGTT&#34; --&amp;gt; &#34;AACCGGTA&#34;&lt;/code&gt; is one mutation.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;There is also a gene bank &lt;code&gt;bank&lt;/code&gt; that records all the valid gene mutations. A gene must be in &lt;code&gt;bank&lt;/code&gt; to make it a valid gene string.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Plain English Leetcode - 23 Merge k Sorted Lists</title>
      <link>https://alanzhan.dev/en/post/2022-06-25-leetcode-23/</link>
      <pubDate>Sat, 25 Jun 2022 23:29:46 +0800</pubDate>
      <guid>https://alanzhan.dev/en/post/2022-06-25-leetcode-23/</guid>
      <description>&lt;h1 id=&#34;23-merge-k-sorted-lists&#34;&gt;23. Merge k Sorted Lists&lt;/h1&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://leetcode.com/problems/merge-k-sorted-lists/&#34;&gt;https://leetcode.com/problems/merge-k-sorted-lists/&lt;/a&gt;&lt;/p&gt;&#xA;&lt;h3&gt;Hard&lt;/h3&gt;&lt;hr&gt;&lt;div&gt;&lt;p&gt;You are given an array of &lt;code&gt;k&lt;/code&gt; linked-lists &lt;code&gt;lists&lt;/code&gt;, each linked-list is sorted in ascending order.&lt;/p&gt;&#xA;&lt;p&gt;&lt;em&gt;Merge all the linked-lists into one sorted linked-list and return it.&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Example 1:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;strong&gt;Input:&lt;/strong&gt; lists = [[1,4,5],[1,3,4],[2,6]]&#xA;&lt;strong&gt;Output:&lt;/strong&gt; [1,1,2,3,4,4,5,6]&#xA;&lt;strong&gt;Explanation:&lt;/strong&gt; The linked-lists are:&#xA;[&#xA;  1-&amp;gt;4-&amp;gt;5,&#xA;  1-&amp;gt;3-&amp;gt;4,&#xA;  2-&amp;gt;6&#xA;]&#xA;merging them into one sorted list:&#xA;1-&amp;gt;1-&amp;gt;2-&amp;gt;3-&amp;gt;4-&amp;gt;4-&amp;gt;5-&amp;gt;6&#xA;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;strong&gt;Example 2:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;strong&gt;Input:&lt;/strong&gt; lists = []&#xA;&lt;strong&gt;Output:&lt;/strong&gt; []&#xA;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;strong&gt;Example 3:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;strong&gt;Input:&lt;/strong&gt; lists = [[]]&#xA;&lt;strong&gt;Output:&lt;/strong&gt; []&#xA;&lt;/pre&gt;&#xA;&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description>
    </item>
    <item>
      <title>Plain English Leetcode - 200 Number of Islands</title>
      <link>https://alanzhan.dev/en/post/2022-06-23-leetcode-200/</link>
      <pubDate>Thu, 23 Jun 2022 23:50:13 +0800</pubDate>
      <guid>https://alanzhan.dev/en/post/2022-06-23-leetcode-200/</guid>
      <description>&lt;h1 id=&#34;200-number-of-islands&#34;&gt;200. Number of Islands&lt;/h1&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://leetcode.com/problems/number-of-islands/&#34;&gt;https://leetcode.com/problems/number-of-islands/&lt;/a&gt;&lt;/p&gt;&#xA;&lt;h3&gt;Medium&lt;/h3&gt;&lt;hr&gt;&lt;div&gt;&lt;p&gt;Given an &lt;code&gt;m x n&lt;/code&gt; 2D binary grid &lt;code&gt;grid&lt;/code&gt; which represents a map of &lt;code&gt;&#39;1&#39;&lt;/code&gt;s (land) and &lt;code&gt;&#39;0&#39;&lt;/code&gt;s (water), return &lt;em&gt;the number of islands&lt;/em&gt;.&lt;/p&gt;&#xA;&lt;p&gt;An &lt;strong&gt;island&lt;/strong&gt; is surrounded by water and is formed by connecting adjacent lands horizontally or vertically. You may assume all four edges of the grid are all surrounded by water.&lt;/p&gt;&#xA;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Example 1:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;strong&gt;Input:&lt;/strong&gt; grid = [&#xA;  [&#34;1&#34;,&#34;1&#34;,&#34;1&#34;,&#34;1&#34;,&#34;0&#34;],&#xA;  [&#34;1&#34;,&#34;1&#34;,&#34;0&#34;,&#34;1&#34;,&#34;0&#34;],&#xA;  [&#34;1&#34;,&#34;1&#34;,&#34;0&#34;,&#34;0&#34;,&#34;0&#34;],&#xA;  [&#34;0&#34;,&#34;0&#34;,&#34;0&#34;,&#34;0&#34;,&#34;0&#34;]&#xA;]&#xA;&lt;strong&gt;Output:&lt;/strong&gt; 1&#xA;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;strong&gt;Example 2:&lt;/strong&gt;&lt;/p&gt;</description>
    </item>
    <item>
      <title>Plain English Leetcode - 78 Subsets</title>
      <link>https://alanzhan.dev/en/post/2022-06-20-leetcode-78/</link>
      <pubDate>Mon, 20 Jun 2022 18:00:00 +0800</pubDate>
      <guid>https://alanzhan.dev/en/post/2022-06-20-leetcode-78/</guid>
      <description>&lt;h1 id=&#34;78-subsets&#34;&gt;78. Subsets&lt;/h1&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://leetcode.com/problems/subsets/&#34;&gt;https://leetcode.com/problems/subsets/&lt;/a&gt;&lt;/p&gt;&#xA;&lt;h3&gt;Medium&lt;/h3&gt;&lt;hr&gt;&lt;div&gt;&lt;p&gt;Given an integer array &lt;code&gt;nums&lt;/code&gt; of &lt;strong&gt;unique&lt;/strong&gt; elements, return &lt;em&gt;all possible subsets (the power set)&lt;/em&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The solution set &lt;strong&gt;must not&lt;/strong&gt; contain duplicate subsets. Return the solution in &lt;strong&gt;any order&lt;/strong&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Example 1:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;strong&gt;Input:&lt;/strong&gt; nums = [1,2,3]&#xA;&lt;strong&gt;Output:&lt;/strong&gt; [[],[1],[2],[1,2],[3],[1,3],[2,3],[1,2,3]]&#xA;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;strong&gt;Example 2:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;strong&gt;Input:&lt;/strong&gt; nums = [0]&#xA;&lt;strong&gt;Output:&lt;/strong&gt; [[],[0]]&#xA;&lt;/pre&gt;&#xA;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Constraints:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&#x9;&lt;li&gt;&lt;code&gt;1 &amp;lt;= nums.length &amp;lt;= 10&lt;/code&gt;&lt;/li&gt;&#xA;&#x9;&lt;li&gt;&lt;code&gt;-10 &amp;lt;= nums[i] &amp;lt;= 10&lt;/code&gt;&lt;/li&gt;&#xA;&#x9;&lt;li&gt;All the numbers of&amp;nbsp;&lt;code&gt;nums&lt;/code&gt; are &lt;strong&gt;unique&lt;/strong&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/div&gt;&#xA;&lt;hr&gt;&#xA;&lt;h2 id=&#34;problem&#34;&gt;Problem&lt;/h2&gt;&#xA;&lt;p&gt;Given a numeric array, return all possible combinations of its elements.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Plain English Leetcode - 111 Minimum Depth of Binary Tree</title>
      <link>https://alanzhan.dev/en/post/2022-06-16-leetcode-111/</link>
      <pubDate>Thu, 16 Jun 2022 18:00:00 +0800</pubDate>
      <guid>https://alanzhan.dev/en/post/2022-06-16-leetcode-111/</guid>
      <description>&lt;h1 id=&#34;111-minimum-depth-of-binary-tree&#34;&gt;111. Minimum Depth of Binary Tree&lt;/h1&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://leetcode.com/problems/minimum-depth-of-binary-tree/&#34;&gt;https://leetcode.com/problems/minimum-depth-of-binary-tree/&lt;/a&gt;&lt;/p&gt;&#xA;&lt;h3&gt;Easy&lt;/h3&gt;&lt;hr&gt;&lt;div&gt;&lt;p&gt;Given a binary tree, find its minimum depth.&lt;/p&gt;&#xA;&lt;p&gt;The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt;&amp;nbsp;A leaf is a node with no children.&lt;/p&gt;&#xA;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Example 1:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;img alt=&#34;&#34; src=&#34;https://assets.leetcode.com/uploads/2020/10/12/ex_depth.jpg&#34; style=&#34;width: 432px; height: 302px;&#34;&gt;&#xA;&lt;pre&gt;&lt;strong&gt;Input:&lt;/strong&gt; root = [3,9,20,null,null,15,7]&#xA;&lt;strong&gt;Output:&lt;/strong&gt; 2&#xA;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;strong&gt;Example 2:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;strong&gt;Input:&lt;/strong&gt; root = [2,null,3,null,4,null,5,null,6]&#xA;&lt;strong&gt;Output:&lt;/strong&gt; 5&#xA;&lt;/pre&gt;&#xA;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Constraints:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&#x9;&lt;li&gt;The number of nodes in the tree is in the range &lt;code&gt;[0, 10&lt;sup&gt;5&lt;/sup&gt;]&lt;/code&gt;.&lt;/li&gt;&#xA;&#x9;&lt;li&gt;&lt;code&gt;-1000 &amp;lt;= Node.val &amp;lt;= 1000&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/div&gt;&#xA;&lt;hr&gt;&#xA;&lt;h2 id=&#34;problem&#34;&gt;Problem&lt;/h2&gt;&#xA;&lt;p&gt;Find the shallowest leaf node in the tree — what is its depth?&lt;/p&gt;</description>
    </item>
    <item>
      <title>Plain English Leetcode - 104 Maximum Depth of Binary Tree</title>
      <link>https://alanzhan.dev/en/post/2022-06-14-leetcode-104/</link>
      <pubDate>Tue, 14 Jun 2022 18:00:00 +0800</pubDate>
      <guid>https://alanzhan.dev/en/post/2022-06-14-leetcode-104/</guid>
      <description>&lt;h1 id=&#34;104-maximum-depth-of-binary-tree&#34;&gt;104. Maximum Depth of Binary Tree&lt;/h1&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://leetcode.com/problems/maximum-depth-of-binary-tree/&#34;&gt;https://leetcode.com/problems/maximum-depth-of-binary-tree/&lt;/a&gt;&lt;/p&gt;&#xA;&lt;h3&gt;Easy&lt;/h3&gt;&lt;hr&gt;&lt;div&gt;&lt;p&gt;Given the &lt;code&gt;root&lt;/code&gt; of a binary tree, return &lt;em&gt;its maximum depth&lt;/em&gt;.&lt;/p&gt;&#xA;&lt;p&gt;A binary tree&#39;s &lt;strong&gt;maximum depth&lt;/strong&gt;&amp;nbsp;is the number of nodes along the longest path from the root node down to the farthest leaf node.&lt;/p&gt;&#xA;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Example 1:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;img alt=&#34;&#34; src=&#34;https://assets.leetcode.com/uploads/2020/11/26/tmp-tree.jpg&#34; style=&#34;width: 400px; height: 277px;&#34;&gt;&#xA;&lt;pre&gt;&lt;strong&gt;Input:&lt;/strong&gt; root = [3,9,20,null,null,15,7]&#xA;&lt;strong&gt;Output:&lt;/strong&gt; 3&#xA;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;strong&gt;Example 2:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;strong&gt;Input:&lt;/strong&gt; root = [1,null,2]&#xA;&lt;strong&gt;Output:&lt;/strong&gt; 2&#xA;&lt;/pre&gt;&#xA;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Constraints:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&#x9;&lt;li&gt;The number of nodes in the tree is in the range &lt;code&gt;[0, 10&lt;sup&gt;4&lt;/sup&gt;]&lt;/code&gt;.&lt;/li&gt;&#xA;&#x9;&lt;li&gt;&lt;code&gt;-100 &amp;lt;= Node.val &amp;lt;= 100&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/div&gt;&#xA;&lt;hr&gt;&#xA;&lt;h2 id=&#34;problem&#34;&gt;Problem&lt;/h2&gt;&#xA;&lt;p&gt;Find the deepest node in the tree — what is its depth?&lt;/p&gt;</description>
    </item>
    <item>
      <title>How to Survive in a Winner-Take-All Workplace</title>
      <link>https://alanzhan.dev/en/post/2022-06-13-winners-take-all/</link>
      <pubDate>Mon, 13 Jun 2022 18:00:00 +0800</pubDate>
      <guid>https://alanzhan.dev/en/post/2022-06-13-winners-take-all/</guid>
      <description>&lt;p&gt;&amp;ldquo;Winner takes all&amp;rdquo; — the meaning is pretty clear from the phrase itself, and it happens constantly in our lives. Here&amp;rsquo;s a simple example: in a democratic society, there&amp;rsquo;s a presidential election every few years. Only the candidate with the most votes wins and becomes the next president — second and third place seem far less important. In romance, every man can pursue their dream partner, but ultimately only one wins. On the sports field, in companies, everywhere — most scenarios are winner-take-all.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Plain English Leetcode - 226 Invert Binary Tree</title>
      <link>https://alanzhan.dev/en/post/2022-06-12-leetcode-226/</link>
      <pubDate>Sun, 12 Jun 2022 13:01:44 +0800</pubDate>
      <guid>https://alanzhan.dev/en/post/2022-06-12-leetcode-226/</guid>
      <description>&lt;h1 id=&#34;226-invert-binary-tree&#34;&gt;226. Invert Binary Tree&lt;/h1&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://leetcode.com/problems/invert-binary-tree/&#34;&gt;https://leetcode.com/problems/invert-binary-tree/&lt;/a&gt;&lt;/p&gt;&#xA;&lt;h3&gt;Easy&lt;/h3&gt;&lt;hr&gt;&lt;div&gt;&lt;p&gt;Given the &lt;code&gt;root&lt;/code&gt; of a binary tree, invert the tree, and return &lt;em&gt;its root&lt;/em&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Example 1:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;img alt=&#34;&#34; src=&#34;https://assets.leetcode.com/uploads/2021/03/14/invert1-tree.jpg&#34; style=&#34;width: 500px; height: 165px;&#34;&gt;&#xA;&lt;pre&gt;&lt;strong&gt;Input:&lt;/strong&gt; root = [4,2,7,1,3,6,9]&#xA;&lt;strong&gt;Output:&lt;/strong&gt; [4,7,2,9,6,3,1]&#xA;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;strong&gt;Example 2:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;img alt=&#34;&#34; src=&#34;https://assets.leetcode.com/uploads/2021/03/14/invert2-tree.jpg&#34; style=&#34;width: 500px; height: 120px;&#34;&gt;&#xA;&lt;pre&gt;&lt;strong&gt;Input:&lt;/strong&gt; root = [2,1,3]&#xA;&lt;strong&gt;Output:&lt;/strong&gt; [2,3,1]&#xA;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;strong&gt;Example 3:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;strong&gt;Input:&lt;/strong&gt; root = []&#xA;&lt;strong&gt;Output:&lt;/strong&gt; []&#xA;&lt;/pre&gt;&#xA;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Constraints:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&#x9;&lt;li&gt;The number of nodes in the tree is in the range &lt;code&gt;[0, 100]&lt;/code&gt;.&lt;/li&gt;&#xA;&#x9;&lt;li&gt;&lt;code&gt;-100 &amp;lt;= Node.val &amp;lt;= 100&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/div&gt;&#xA;&lt;hr&gt;&#xA;&lt;h2 id=&#34;problem&#34;&gt;Problem&lt;/h2&gt;&#xA;&lt;p&gt;Swap all left and right nodes of the entire tree.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Kubernetes Core Component: Scheduler</title>
      <link>https://alanzhan.dev/en/post/2022-05-16-kubernetes-scheduler/</link>
      <pubDate>Mon, 16 May 2022 22:40:48 +0800</pubDate>
      <guid>https://alanzhan.dev/en/post/2022-05-16-kubernetes-scheduler/</guid>
      <description>&lt;p&gt;Strictly speaking, the Scheduler is a special type of Controller — its working principle is no different from other controllers.&lt;/p&gt;&#xA;&lt;p&gt;The Scheduler&amp;rsquo;s special responsibility is to monitor all unscheduled Pods in the cluster and obtain the health status and resource usage of all nodes, selecting the best node for each pending Pod to complete scheduling.&lt;/p&gt;&#xA;&lt;p&gt;kube-scheduler is responsible for assigning and scheduling Pods to nodes within the cluster. It watches kube-apiserver for Pods that haven&amp;rsquo;t been assigned to a Node, then assigns nodes to these Pods based on scheduling policies (by updating the Pod&amp;rsquo;s NodeName field).&lt;/p&gt;</description>
    </item>
    <item>
      <title>Kubernetes Core Component: API Server</title>
      <link>https://alanzhan.dev/en/post/2022-04-24-kubernetes-api-server/</link>
      <pubDate>Sun, 24 Apr 2022 19:07:12 +0800</pubDate>
      <guid>https://alanzhan.dev/en/post/2022-04-24-kubernetes-api-server/</guid>
      <description>&lt;h1 id=&#34;api-server&#34;&gt;API Server&lt;/h1&gt;&#xA;&lt;p&gt;kube-apiserver is one of the most important core components of Kubernetes, providing the following key features:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Cluster management REST API, including authentication, authorization, data validation, and cluster state changes&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Authentication&lt;/li&gt;&#xA;&lt;li&gt;Authorization&lt;/li&gt;&#xA;&lt;li&gt;Admission (Mutating &amp;amp; Validating)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;Acts as the data exchange and communication hub between other modules. Other modules can only query or modify data through the API Server — only the API Server can directly operate on etcd.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;kube-apiserver supports HTTPS (default port 6443) and HTTP API (default listening on 127.0.0.1:8080). The HTTP API is insecure with no authentication or authorization mechanism — it&amp;rsquo;s not recommended for production environments.&lt;/p&gt;</description>
    </item>
    <item>
      <title>MongoDB Index Best Practices</title>
      <link>https://alanzhan.dev/en/post/2022-04-10-mongodb-index-best-practice/</link>
      <pubDate>Sun, 10 Apr 2022 16:19:10 +0800</pubDate>
      <guid>https://alanzhan.dev/en/post/2022-04-10-mongodb-index-best-practice/</guid>
      <description>&lt;p&gt;After the sorted operation OOM incident in production from the previous post, I realized my understanding of MongoDB indexes wasn&amp;rsquo;t as deep as it should be. I started searching extensively and finally organized some key points. Some were covered in the previous post — feel free to review &lt;a href=&#34;https://alanzhan.dev/en/post/2022-03-20-mongodb-sorted-operation-oom/&#34;&gt;MongoDB Sorted Operation OOM&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h1 id=&#34;when-to-use-indexes&#34;&gt;When to Use Indexes&lt;/h1&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;When you have sorting scenarios and in-memory sorting exceeds 32 MB.&lt;/li&gt;&#xA;&lt;li&gt;When a specific field has a uniqueness requirement.&lt;/li&gt;&#xA;&lt;li&gt;When the document count is large.&lt;/li&gt;&#xA;&lt;li&gt;Build indexes on high-cardinality fields.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h1 id=&#34;when-not-to-use-indexes&#34;&gt;When NOT to Use Indexes&lt;/h1&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;When an index cannot effectively filter data.&lt;/li&gt;&#xA;&lt;li&gt;Don&amp;rsquo;t set indexes on frequently updated fields.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h1 id=&#34;how-to-design-and-use-indexes&#34;&gt;How to Design and Use Indexes&lt;/h1&gt;&#xA;&lt;h2 id=&#34;use-compound-indexes-instead-of-single-field-indexes&#34;&gt;Use Compound Indexes Instead of Single Field Indexes&lt;/h2&gt;&#xA;&lt;p&gt;In MongoDB, a find query can only use one index at a time (in most scenarios). So if your use case frequently filters on multiple fields, use a Compound Index composed of multiple fields to match your query conditions.&lt;/p&gt;</description>
    </item>
    <item>
      <title>MongoDB Sorted Operation OOM</title>
      <link>https://alanzhan.dev/en/post/2022-03-20-mongodb-sorted-operation-oom/</link>
      <pubDate>Sun, 20 Mar 2022 15:11:15 +0800</pubDate>
      <guid>https://alanzhan.dev/en/post/2022-03-20-mongodb-sorted-operation-oom/</guid>
      <description>&lt;p&gt;This is a rare case where I learned by working backward from a problem — I&amp;rsquo;d better document it well. Recently, our production environment hit a MongoDB sort operation limit with this specific error:&lt;/p&gt;&#xA;&lt;p&gt;MongoDB.Driver.MongoCommandException: Command find failed: Encountered non-retryable error during query :: caused by :: Executor error during find command :: caused by :: Sort operation used more than the maximum 33554432 bytes of RAM.&lt;/p&gt;&#xA;&lt;p&gt;Well, the problem has occurred. Let&amp;rsquo;s solve it first — so we added an index as an immediate fix. But what exactly is a MongoDB index?&lt;/p&gt;</description>
    </item>
    <item>
      <title>Kubernetes Core Component: etcd</title>
      <link>https://alanzhan.dev/en/post/2022-02-28-kubetnetes-etcd/</link>
      <pubDate>Mon, 28 Feb 2022 15:58:47 +0800</pubDate>
      <guid>https://alanzhan.dev/en/post/2022-02-28-kubetnetes-etcd/</guid>
      <description>&lt;p&gt;In any system, what is the most important thing? The answer is simple: data. So I&amp;rsquo;m starting my deep dive with Kubernetes&amp;rsquo; database — etcd!&lt;/p&gt;&#xA;&lt;h1 id=&#34;what-is-etcd&#34;&gt;What is etcd?&lt;/h1&gt;&#xA;&lt;p&gt;etcd is a distributed key-value store developed by CoreOS based on the Raft algorithm. It can be used for service discovery, shared configuration, and consistency guarantees (such as database leader election, distributed locks, etc.).&lt;/p&gt;&#xA;&lt;p&gt;In distributed systems, managing state across nodes has always been challenging. etcd is designed specifically for service discovery and registration in cluster environments. It provides features like data TTL expiration, data change monitoring, multi-value operations, directory watching, distributed lock atomic operations, and more — making it easy to track and manage cluster node states.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Installing Kubernetes with Kubeadm - Twice</title>
      <link>https://alanzhan.dev/en/post/2022-02-20-reinstall-kubernetes-kubeadm/</link>
      <pubDate>Sun, 20 Feb 2022 15:04:19 +0800</pubDate>
      <guid>https://alanzhan.dev/en/post/2022-02-20-reinstall-kubernetes-kubeadm/</guid>
      <description>&lt;p&gt;To better understand K8s through hands-on practice, I wanted to set up a K8s cluster myself. There are increasingly many ways to self-host K8s nowadays — minikube, Kubeadm, and more. I decided to go with Kubeadm, but the installation wasn&amp;rsquo;t exactly smooth. This post shares the problems I encountered and how I solved them.&lt;/p&gt;&#xA;&lt;h1 id=&#34;first-installation-of-kubeadm&#34;&gt;First Installation of Kubeadm&lt;/h1&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Install Ubuntu.&lt;/li&gt;&#xA;&lt;li&gt;Install Docker.&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Modify Docker&amp;rsquo;s cgroup settings to ensure the K8s and container runtime cgroup drivers match, preventing system instability.&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo vim /etc/docker/daemon.json&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-json&#34; data-lang=&#34;json&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#ff79c6&#34;&gt;&amp;#34;exec-opts&amp;#34;&lt;/span&gt;: [&lt;span style=&#34;color:#f1fa8c&#34;&gt;&amp;#34;native.cgroupdriver=systemd&amp;#34;&lt;/span&gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;&#xA;&lt;li&gt;Restart Docker&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo systemctl restart docker&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;Install Kubeadm.&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Allow iptables to inspect bridged traffic.&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cat &lt;span style=&#34;color:#f1fa8c&#34;&gt;&amp;lt;&amp;lt;EOF | sudo tee /etc/modules-load.d/k8s.conf&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f1fa8c&#34;&gt;br_netfilter&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f1fa8c&#34;&gt;EOF&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cat &lt;span style=&#34;color:#f1fa8c&#34;&gt;&amp;lt;&amp;lt;EOF | sudo tee /etc/sysctl.d/k8s.conf&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f1fa8c&#34;&gt;net.bridge.bridge-nf-call-ip6tables = 1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f1fa8c&#34;&gt;net.bridge.bridge-nf-call-iptables = 1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f1fa8c&#34;&gt;EOF&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo sysctl --system&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;&#xA;&lt;li&gt;Update apt and install packages required by K8s.&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo apt-get update&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo apt-get install -y apt-transport-https ca-certificates curl&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;&#xA;&lt;li&gt;Download the Google Cloud public signing key.&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;&#xA;&lt;li&gt;Add the K8s apt repository.&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#8be9fd;font-style:italic&#34;&gt;echo&lt;/span&gt; &lt;span style=&#34;color:#f1fa8c&#34;&gt;&amp;#34;deb [signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main&amp;#34;&lt;/span&gt; | sudo tee /etc/apt/sources.list.d/kubernetes.list&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;&#xA;&lt;li&gt;Update the apt package index, install kubelet, kubeadm, and kubectl, and pin their versions.&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo apt-get update&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo apt-get install -y kubelet kubeadm kubectl&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo apt-mark hold kubelet kubeadm kubectl&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;&#xA;&lt;li&gt;Initialize K8s.&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo kubeadm init&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;&#xA;&lt;li&gt;Join worker nodes&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo kubeadm join 192.168.83.130:6443 --token token....  --discovery-token-ca-cert-hash sha256:......................&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;&#xA;&lt;li&gt;Copy kubeconfig&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;mkdir -p &lt;span style=&#34;color:#8be9fd;font-style:italic&#34;&gt;$HOME&lt;/span&gt;/.kube&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo cp -i /etc/kubernetes/admin.conf &lt;span style=&#34;color:#8be9fd;font-style:italic&#34;&gt;$HOME&lt;/span&gt;/.kube/config&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo chown &lt;span style=&#34;color:#ff79c6&#34;&gt;$(&lt;/span&gt;id -u&lt;span style=&#34;color:#ff79c6&#34;&gt;)&lt;/span&gt;:&lt;span style=&#34;color:#ff79c6&#34;&gt;$(&lt;/span&gt;id -g&lt;span style=&#34;color:#ff79c6&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color:#8be9fd;font-style:italic&#34;&gt;$HOME&lt;/span&gt;/.kube/config&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;h2 id=&#34;k8s-nodes-not-ready&#34;&gt;K8s Nodes Not Ready&lt;/h2&gt;&#xA;&lt;p&gt;I finally got it installed! So I added the worker nodes to the cluster. After joining, just as I was about to start using K8s, I noticed all nodes were in NotReady status.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Kubernetes Fundamentals</title>
      <link>https://alanzhan.dev/en/post/2022-02-14-kubernetes-introduction/</link>
      <pubDate>Mon, 14 Feb 2022 21:48:40 +0800</pubDate>
      <guid>https://alanzhan.dev/en/post/2022-02-14-kubernetes-introduction/</guid>
      <description>&lt;p&gt;It&amp;rsquo;s finally time to dive deep into Kubernetes. Since Kubernetes is built with Go, I&amp;rsquo;ve already done some in-depth research on Go beforehand. I won&amp;rsquo;t be covering Docker and container technology here since I&amp;rsquo;ve already studied those extensively. If you&amp;rsquo;d like to see that content, let me know! From here on, I&amp;rsquo;ll be writing a series of articles focused on Kubernetes.&lt;/p&gt;&#xA;&lt;h1 id=&#34;kubernetes&#34;&gt;Kubernetes&lt;/h1&gt;&#xA;&lt;p&gt;What is Kubernetes (K8s)? K8s is the abbreviation for Kubernetes — because there are eight letters between &amp;ldquo;K&amp;rdquo; and &amp;ldquo;s.&amp;rdquo; It&amp;rsquo;s Google&amp;rsquo;s open-source container cluster management system, the open-source version of Google&amp;rsquo;s years of large-scale container management technology called Borg. Its main features include:&lt;/p&gt;</description>
    </item>
    <item>
      <title>Golang Memory Management and GC In-Depth Analysis</title>
      <link>https://alanzhan.dev/en/post/2022-02-13-golang-memory-management/</link>
      <pubDate>Sun, 13 Feb 2022 14:42:09 +0800</pubDate>
      <guid>https://alanzhan.dev/en/post/2022-02-13-golang-memory-management/</guid>
      <description>&lt;p&gt;A new year has arrived! After completing the analysis of &lt;a href=&#34;https://alanzhan.dev/en/post/2022-01-24-golang-goroutine/&#34;&gt;Golang Goroutine and GMP Model In-Depth Analysis&lt;/a&gt;, I gained a much more comprehensive understanding of the Go language. But after learning about GMP, aren&amp;rsquo;t we still missing the memory management aspect? So today, let&amp;rsquo;s dive deep into how Go manages its memory.&lt;/p&gt;&#xA;&lt;h1 id=&#34;the-memory-management-debate&#34;&gt;The Memory Management Debate&lt;/h1&gt;&#xA;&lt;p&gt;When it comes to memory management, there&amp;rsquo;s been a long-standing debate: who should manage memory — the machine or the developer? Whether it&amp;rsquo;s machine-managed or human-managed, everyone agrees that memory management is critically important, but opinions diverge:&lt;/p&gt;</description>
    </item>
    <item>
      <title>Golang Goroutine and GMP Model In-Depth Analysis</title>
      <link>https://alanzhan.dev/en/post/2022-01-24-golang-goroutine/</link>
      <pubDate>Mon, 24 Jan 2022 20:24:58 +0800</pubDate>
      <guid>https://alanzhan.dev/en/post/2022-01-24-golang-goroutine/</guid>
      <description>&lt;p&gt;I&amp;rsquo;ve been studying Kubernetes recently, so I need to become good friends with the Go language. While reading, I came across goroutines, but couldn&amp;rsquo;t fully understand where they came from and why they exist. So before we dive deep into goroutines, we should first learn some history — this will give us a more comprehensive understanding of the principles and design philosophy behind goroutines.&lt;/p&gt;&#xA;&lt;h1 id=&#34;the-origin-of-golangs-scheduler&#34;&gt;The Origin of Golang&amp;rsquo;s Scheduler&lt;/h1&gt;&#xA;&lt;h2 id=&#34;the-single-process-era&#34;&gt;The Single-Process Era&lt;/h2&gt;&#xA;&lt;p&gt;We know that software runs on top of the operating system, and the CPU does the actual computation. In early operating systems, each program was a process, and the next process could only run after the current one finished.&lt;/p&gt;</description>
    </item>
    <item>
      <title>10 Dockerfile Best Practices</title>
      <link>https://alanzhan.dev/en/post/2022-01-16-dockerfile-best-practices/</link>
      <pubDate>Sun, 16 Jan 2022 16:55:15 +0800</pubDate>
      <guid>https://alanzhan.dev/en/post/2022-01-16-dockerfile-best-practices/</guid>
      <description>&lt;p&gt;I was recently organizing Docker knowledge for myself and came across Dockerfile best practices. I planned to summarize them, but then I found that the official documentation already has best practices, so I decided to translate them and add my own insights.&lt;/p&gt;&#xA;&lt;h1 id=&#34;containers-should-be-ephemeral&#34;&gt;Containers Should Be Ephemeral&lt;/h1&gt;&#xA;&lt;p&gt;Containers built from a &lt;code&gt;Dockerfile&lt;/code&gt; should be as ephemeral as possible. &amp;ldquo;Ephemeral&amp;rdquo; here means they can be started quickly and stopped quickly.&lt;/p&gt;&#xA;&lt;h1 id=&#34;understand-the-build-context&#34;&gt;Understand the Build Context&lt;/h1&gt;&#xA;&lt;p&gt;Including files that aren&amp;rsquo;t needed to build the image results in a larger build context and larger image. This increases build time, pull/push time, and the runtime size of the container.&lt;/p&gt;</description>
    </item>
    <item>
      <title>GitHub Pages Custom Domain Setup</title>
      <link>https://alanzhan.dev/en/post/2022-01-09-github-pages-custom-domain/</link>
      <pubDate>Sun, 09 Jan 2022 14:58:58 +0800</pubDate>
      <guid>https://alanzhan.dev/en/post/2022-01-09-github-pages-custom-domain/</guid>
      <description>&lt;p&gt;I recently switched my domain name, so I decided to take some notes to help everyone easily set up their own GitHub Pages custom domain.&lt;/p&gt;&#xA;&lt;h1 id=&#34;step-1-purchase-a-domain&#34;&gt;Step 1: Purchase a Domain&lt;/h1&gt;&#xA;&lt;p&gt;First, purchase the domain name you want. I bought mine from Google Domains. If you have a preferred domain registrar, feel free to use that. This guide uses Google Domains as an example.&lt;/p&gt;&#xA;&lt;h1 id=&#34;step-2-add-a-cname-record-in-dns-settings&#34;&gt;Step 2: Add a CNAME Record in DNS Settings&lt;/h1&gt;&#xA;&lt;p&gt;After purchasing the domain, you need to configure the DNS settings. Follow the diagram below to set things up.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Interpolation Search Algorithm</title>
      <link>https://alanzhan.dev/en/post/2021-07-13-interpolation-search-algorithm/</link>
      <pubDate>Tue, 13 Jul 2021 21:51:30 +0800</pubDate>
      <guid>https://alanzhan.dev/en/post/2021-07-13-interpolation-search-algorithm/</guid>
      <description>&lt;p&gt;Continuing with the number guessing game — for numbers 1 to 100, if you already know the result, using binary search might not be the most efficient approach. So what method should we use instead?&lt;/p&gt;&#xA;&lt;h1 id=&#34;concept&#34;&gt;Concept&lt;/h1&gt;&#xA;&lt;p&gt;Interpolation Search: This is an algorithm based on binary search. &lt;code&gt;The list being searched must be sorted beforehand&lt;/code&gt;, and the data distribution should ideally be &lt;code&gt;linear&lt;/code&gt;. If the data is not linearly distributed, the search may result in O(n) performance, which could be even slower than binary search.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Jump Search Algorithm</title>
      <link>https://alanzhan.dev/en/post/2021-07-11-jump-search-alogrithm/</link>
      <pubDate>Sun, 11 Jul 2021 14:48:35 +0800</pubDate>
      <guid>https://alanzhan.dev/en/post/2021-07-11-jump-search-alogrithm/</guid>
      <description>&lt;p&gt;Continuing with the number guessing game — can we try a different approach for numbers 1 to 100?&lt;/p&gt;&#xA;&lt;p&gt;If we start from the beginning and jump forward by 10 each time we don&amp;rsquo;t guess correctly, we keep going until the maximum value in our range becomes less than or equal to our guess, then we search backward to find the exact value. This approach can be more efficient when the target value is relatively small.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Binary Search Algorithm</title>
      <link>https://alanzhan.dev/en/post/2021-07-10-binary-search-algorithm/</link>
      <pubDate>Sat, 10 Jul 2021 22:57:37 +0800</pubDate>
      <guid>https://alanzhan.dev/en/post/2021-07-10-binary-search-algorithm/</guid>
      <description>&lt;p&gt;Let&amp;rsquo;s play a number guessing game. Pick an integer between 1 and 100 — you have to guess the number in my head, and you must do it in the fewest guesses possible. How would you approach it?&lt;/p&gt;&#xA;&lt;p&gt;The answer is simple: you&amp;rsquo;d start by guessing 50. If it&amp;rsquo;s wrong and too high, you&amp;rsquo;d guess 25 next. If too low, you&amp;rsquo;d guess 75. And so on — each time you split the remaining range in half. What you&amp;rsquo;re using is essentially Binary Search.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Linear Search Algorithm</title>
      <link>https://alanzhan.dev/en/post/2021-07-10-linear-search-algorithm/</link>
      <pubDate>Sat, 10 Jul 2021 18:50:40 +0800</pubDate>
      <guid>https://alanzhan.dev/en/post/2021-07-10-linear-search-algorithm/</guid>
      <description>&lt;p&gt;When checking whether an element exists, what is the most common approach? The answer is a for or while loop. Congratulations — you&amp;rsquo;ve already learned Linear Search!&lt;/p&gt;&#xA;&lt;h1 id=&#34;concept&#34;&gt;Concept&lt;/h1&gt;&#xA;&lt;p&gt;Linear Search: This algorithm &lt;code&gt;visits every element&lt;/code&gt; to check where the element is located in the array. If the element is not found, it returns -1.&lt;/p&gt;&#xA;&lt;h1 id=&#34;complexity&#34;&gt;Complexity&lt;/h1&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Time complexity: O(n)&lt;/li&gt;&#xA;&lt;li&gt;Space complexity: O(1)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h1 id=&#34;examples&#34;&gt;Examples&lt;/h1&gt;&#xA;&lt;h2 id=&#34;go&#34;&gt;Go&lt;/h2&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-go&#34; data-lang=&#34;go&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ff79c6&#34;&gt;package&lt;/span&gt; main&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ff79c6&#34;&gt;import&lt;/span&gt; &lt;span style=&#34;color:#f1fa8c&#34;&gt;&amp;#34;fmt&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#8be9fd;font-style:italic&#34;&gt;func&lt;/span&gt; &lt;span style=&#34;color:#50fa7b&#34;&gt;linearSearch&lt;/span&gt;(list []&lt;span style=&#34;color:#8be9fd&#34;&gt;int&lt;/span&gt;, target &lt;span style=&#34;color:#8be9fd&#34;&gt;int&lt;/span&gt;) &lt;span style=&#34;color:#8be9fd&#34;&gt;int&lt;/span&gt; {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#ff79c6&#34;&gt;for&lt;/span&gt; i &lt;span style=&#34;color:#ff79c6&#34;&gt;:=&lt;/span&gt; &lt;span style=&#34;color:#bd93f9&#34;&gt;0&lt;/span&gt;; i &amp;lt; &lt;span style=&#34;color:#8be9fd;font-style:italic&#34;&gt;len&lt;/span&gt;(list); i&lt;span style=&#34;color:#ff79c6&#34;&gt;++&lt;/span&gt; {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#ff79c6&#34;&gt;if&lt;/span&gt; list[i] &lt;span style=&#34;color:#ff79c6&#34;&gt;==&lt;/span&gt; target {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            &lt;span style=&#34;color:#ff79c6&#34;&gt;return&lt;/span&gt; i&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        }&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    }&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#ff79c6&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#ff79c6&#34;&gt;-&lt;/span&gt;&lt;span style=&#34;color:#bd93f9&#34;&gt;1&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#8be9fd;font-style:italic&#34;&gt;func&lt;/span&gt; &lt;span style=&#34;color:#50fa7b&#34;&gt;main&lt;/span&gt;() {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    fmt.&lt;span style=&#34;color:#50fa7b&#34;&gt;Println&lt;/span&gt;(&lt;span style=&#34;color:#50fa7b&#34;&gt;linearSearch&lt;/span&gt;([]&lt;span style=&#34;color:#8be9fd&#34;&gt;int&lt;/span&gt;{&lt;span style=&#34;color:#bd93f9&#34;&gt;1&lt;/span&gt;, &lt;span style=&#34;color:#bd93f9&#34;&gt;2&lt;/span&gt;, &lt;span style=&#34;color:#bd93f9&#34;&gt;3&lt;/span&gt;, &lt;span style=&#34;color:#bd93f9&#34;&gt;4&lt;/span&gt;, &lt;span style=&#34;color:#bd93f9&#34;&gt;5&lt;/span&gt;}, &lt;span style=&#34;color:#bd93f9&#34;&gt;3&lt;/span&gt;)) &lt;span style=&#34;color:#6272a4&#34;&gt;// 2&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    fmt.&lt;span style=&#34;color:#50fa7b&#34;&gt;Println&lt;/span&gt;(&lt;span style=&#34;color:#50fa7b&#34;&gt;linearSearch&lt;/span&gt;([]&lt;span style=&#34;color:#8be9fd&#34;&gt;int&lt;/span&gt;{&lt;span style=&#34;color:#bd93f9&#34;&gt;1&lt;/span&gt;, &lt;span style=&#34;color:#bd93f9&#34;&gt;2&lt;/span&gt;, &lt;span style=&#34;color:#bd93f9&#34;&gt;3&lt;/span&gt;, &lt;span style=&#34;color:#bd93f9&#34;&gt;4&lt;/span&gt;, &lt;span style=&#34;color:#bd93f9&#34;&gt;5&lt;/span&gt;}, &lt;span style=&#34;color:#bd93f9&#34;&gt;6&lt;/span&gt;)) &lt;span style=&#34;color:#6272a4&#34;&gt;// -1&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;c&#34;&gt;C#&lt;/h2&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-C#&#34; data-lang=&#34;C#&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ff79c6&#34;&gt;class&lt;/span&gt; &lt;span style=&#34;color:#50fa7b&#34;&gt;Algorithm&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#8be9fd;font-style:italic&#34;&gt;public&lt;/span&gt; &lt;span style=&#34;color:#8be9fd;font-style:italic&#34;&gt;static&lt;/span&gt; &lt;span style=&#34;color:#8be9fd&#34;&gt;int&lt;/span&gt; linearSearch(&lt;span style=&#34;color:#8be9fd&#34;&gt;int&lt;/span&gt;[] list, &lt;span style=&#34;color:#8be9fd&#34;&gt;int&lt;/span&gt; target)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#ff79c6&#34;&gt;for&lt;/span&gt; (&lt;span style=&#34;color:#8be9fd&#34;&gt;var&lt;/span&gt; i = &lt;span style=&#34;color:#bd93f9&#34;&gt;0&lt;/span&gt;; i &amp;lt; list.Length; i++)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            &lt;span style=&#34;color:#ff79c6&#34;&gt;if&lt;/span&gt; (list[i] == target)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;                &lt;span style=&#34;color:#ff79c6&#34;&gt;return&lt;/span&gt; i;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            }&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        }&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#ff79c6&#34;&gt;return&lt;/span&gt; -&lt;span style=&#34;color:#bd93f9&#34;&gt;1&lt;/span&gt;;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    }&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#8be9fd;font-style:italic&#34;&gt;public&lt;/span&gt; &lt;span style=&#34;color:#8be9fd;font-style:italic&#34;&gt;static&lt;/span&gt; &lt;span style=&#34;color:#ff79c6&#34;&gt;void&lt;/span&gt; Main(String[] args)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        Console.WriteLine(linearSearch(&lt;span style=&#34;color:#ff79c6&#34;&gt;new&lt;/span&gt; &lt;span style=&#34;color:#8be9fd&#34;&gt;int&lt;/span&gt;[] {&lt;span style=&#34;color:#bd93f9&#34;&gt;1&lt;/span&gt;, &lt;span style=&#34;color:#bd93f9&#34;&gt;2&lt;/span&gt;, &lt;span style=&#34;color:#bd93f9&#34;&gt;3&lt;/span&gt;, &lt;span style=&#34;color:#bd93f9&#34;&gt;4&lt;/span&gt;, &lt;span style=&#34;color:#bd93f9&#34;&gt;5&lt;/span&gt;}, &lt;span style=&#34;color:#bd93f9&#34;&gt;3&lt;/span&gt;)); &lt;span style=&#34;color:#6272a4&#34;&gt;// 2&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        Console.WriteLine(linearSearch(&lt;span style=&#34;color:#ff79c6&#34;&gt;new&lt;/span&gt; &lt;span style=&#34;color:#8be9fd&#34;&gt;int&lt;/span&gt;[] {&lt;span style=&#34;color:#bd93f9&#34;&gt;1&lt;/span&gt;, &lt;span style=&#34;color:#bd93f9&#34;&gt;2&lt;/span&gt;, &lt;span style=&#34;color:#bd93f9&#34;&gt;3&lt;/span&gt;, &lt;span style=&#34;color:#bd93f9&#34;&gt;4&lt;/span&gt;, &lt;span style=&#34;color:#bd93f9&#34;&gt;5&lt;/span&gt;}, &lt;span style=&#34;color:#bd93f9&#34;&gt;6&lt;/span&gt;)); &lt;span style=&#34;color:#6272a4&#34;&gt;// -1&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    }&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Feel free to leave a comment on my blog. Your feedback motivates me to keep writing. Thank you for reading, and let&amp;rsquo;s grow together to become better versions of ourselves.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Divide and Conquer</title>
      <link>https://alanzhan.dev/en/post/2021-07-07-divide-and-conquer/</link>
      <pubDate>Wed, 07 Jul 2021 23:56:34 +0800</pubDate>
      <guid>https://alanzhan.dev/en/post/2021-07-07-divide-and-conquer/</guid>
      <description>&lt;h1 id=&#34;divide-and-conquer&#34;&gt;Divide and Conquer&lt;/h1&gt;&#xA;&lt;p&gt;As the name suggests, this approach breaks a complex problem into two or more identical or similar subproblems, solves the smaller problems, and then combines the results to produce the final answer.&lt;/p&gt;&#xA;&lt;h2 id=&#34;advantages&#34;&gt;Advantages&lt;/h2&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Reduces the difficulty of solving the problem.&lt;/li&gt;&#xA;&lt;li&gt;Can improve execution efficiency.&lt;/li&gt;&#xA;&lt;li&gt;In some cases, enables parallel processing to boost performance.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;h2 id=&#34;steps&#34;&gt;Steps&lt;/h2&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Divide: Break the problem into several smaller subproblems that are relatively independent and share the same form as the original problem.&lt;/li&gt;&#xA;&lt;li&gt;Conquer: If the subproblem is small enough and easy to solve, solve it directly. Otherwise, solve the subproblems recursively.&lt;/li&gt;&#xA;&lt;li&gt;Combine: Merge the solutions of the subproblems into the solution for the original problem.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Resources:&lt;/p&gt;</description>
    </item>
    <item>
      <title>Big O Notation</title>
      <link>https://alanzhan.dev/en/post/2021-07-06-big-o-notation/</link>
      <pubDate>Tue, 06 Jul 2021 23:56:58 +0800</pubDate>
      <guid>https://alanzhan.dev/en/post/2021-07-06-big-o-notation/</guid>
      <description>&lt;h1 id=&#34;how-to-choose-an-algorithm-to-solve-a-problem&#34;&gt;How to Choose an Algorithm to Solve a Problem&lt;/h1&gt;&#xA;&lt;p&gt;The same problem can be solved using different algorithms, but which one is the best? There are two metrics for evaluating an algorithm:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Time complexity (time consumed)&lt;/li&gt;&#xA;&lt;li&gt;Space complexity (memory consumed)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Generally, the less time and memory an algorithm uses, the better it is. Time complexity analysis can be further broken down into three cases:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Best case: Considers the &lt;code&gt;minimum&lt;/code&gt; number of steps the algorithm needs to execute.&lt;/li&gt;&#xA;&lt;li&gt;Worst case: Considers the &lt;code&gt;maximum&lt;/code&gt; number of steps the algorithm needs to execute.&lt;/li&gt;&#xA;&lt;li&gt;Average case: Considers the &lt;code&gt;average&lt;/code&gt; number of steps the algorithm needs to execute.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h1 id=&#34;big-o-notation-as-a-measurement-standard&#34;&gt;Big O Notation as a Measurement Standard&lt;/h1&gt;&#xA;&lt;p&gt;Typically, we focus on finding the worst case, and we usually use &lt;code&gt;Big O notation&lt;/code&gt; — a method for evaluating algorithm efficiency that represents execution speed and typically indicates the worst-case execution time.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Emotional Blackmail</title>
      <link>https://alanzhan.dev/en/post/2021-06-26-emotional-blackmail/</link>
      <pubDate>Sat, 26 Jun 2021 18:46:52 +0800</pubDate>
      <guid>https://alanzhan.dev/en/post/2021-06-26-emotional-blackmail/</guid>
      <description>&lt;h1 id=&#34;what-is-emotional-blackmail&#34;&gt;What Is Emotional Blackmail?&lt;/h1&gt;&#xA;&lt;p&gt;Before discussing emotional blackmail, we need to understand what it actually is.&lt;/p&gt;&#xA;&lt;p&gt;Emotional blackmailers may consciously or unconsciously use demands, threats, pressure, silence, and other direct or indirect means of &lt;code&gt;blackmail&lt;/code&gt; to cause negative emotions in the victim — such as frustration, guilt, fear, and so on. These feelings then ferment and cause harm within the victim.&lt;/p&gt;&#xA;&lt;p&gt;To reduce these uncomfortable feelings, the victim may comply with the blackmailer&amp;rsquo;s demands. Over time, this forms a vicious cycle where the victim allows the blackmailer to control them through these tactics, losing the freedom and ability to make their own decisions. Eventually, the victim&amp;rsquo;s &lt;code&gt;sense of self&lt;/code&gt; is completely depleted in the process.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Atomic Habits</title>
      <link>https://alanzhan.dev/en/post/2021-06-13-atomic-habits/</link>
      <pubDate>Sun, 13 Jun 2021 23:45:21 +0800</pubDate>
      <guid>https://alanzhan.dev/en/post/2021-06-13-atomic-habits/</guid>
      <description>&lt;p&gt;&#xA;  &lt;img src=&#34;https://alanzhan.dev/2021-06-13-atomic-habits/2021-06-13-atomic-habits_01.png&#34; alt=&#34;Atomic Habits&#34;&gt;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h1 id=&#34;compound-interest&#34;&gt;Compound Interest&lt;/h1&gt;&#xA;&lt;p&gt;The word &amp;ldquo;compound interest&amp;rdquo; runs throughout this entire book. We can say it is the eighth wonder of the world, and that would be no exaggeration.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;If you improve by just 1% every day for a year (1.01 ^ 365 = 37.78), you will become 37 times better.&lt;/li&gt;&#xA;&lt;li&gt;If you decline by 1% every day for a year (0.99 ^ 365 = 0.03), you will decline to nearly zero.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;So habits are the compound interest of self-improvement.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
