-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathalgolia.json
More file actions
1 lines (1 loc) · 147 KB
/
Copy pathalgolia.json
File metadata and controls
1 lines (1 loc) · 147 KB
1
[{"author":null,"categories":["tech"],"content":"","date":1678615481,"description":"","dir":"post/","excerpt_html":"","excerpt_text":"","expirydate":-62135596800,"fuzzywordcount":1000,"html":"","keywords":["alan","zhan","blog","kubernetes","terraform","private","cluster","GKE","私有","建立"],"kind":"page","lang":"en","lastmod":1678615481,"objectID":"c411a9be2157cebcdcac66ca166bddb0","permalink":"https://alanzhan.dev/en/post/2023-03-12-terraform-private-gke/","publishdate":"2023-03-12T18:04:41+08:00","readingtime":2,"relpermalink":"/en/post/2023-03-12-terraform-private-gke/","section":"post","summary":"\u003cp\u003eLet\u0026rsquo;s spend about ten minutes together — I\u0026rsquo;ll walk you through using Terraform to build a private GKE Cluster step by step!\u003c/p\u003e\n\u003ch2 id=\"setting-up-gcp\"\u003eSetting Up GCP\u003c/h2\u003e\n\u003cp\u003e\n \u003cimg src=\"/2023-03-12-terraform-private-gke/create-service-account.jpg\" alt=\"Create Service Account and Key\"\u003e\n\n\u003c/p\u003e\n\u003ch3 id=\"create-a-service-account\"\u003eCreate a Service Account\u003c/h3\u003e\n\u003cp\u003eFirst, 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.\u003c/p\u003e","tags":["kubernetes","terraform","tech"],"title":"Building a Private GKE Cluster with Terraform","type":"post","url":"/en/post/2023-03-12-terraform-private-gke/","weight":0,"wordcount":934},{"author":null,"categories":["tech"],"content":"","date":1678615481,"description":"","dir":"post/","excerpt_html":"","excerpt_text":"","expirydate":-62135596800,"fuzzywordcount":1300,"html":"","keywords":["alan","zhan","blog","kubernetes","terraform","private","cluster","GKE","私有","建立"],"kind":"page","lang":"zh-tw","lastmod":1678615481,"objectID":"3c3ddb33a5a8c40f1ee8b875aa7ef75c","permalink":"https://alanzhan.dev/post/2023-03-12-terraform-private-gke/","publishdate":"2023-03-12T18:04:41+08:00","readingtime":3,"relpermalink":"/post/2023-03-12-terraform-private-gke/","section":"post","summary":"\u003cp\u003e讓我們一起來花個十分鐘,我會手把手地教你使用 Terraform ,建立私有的 GKE Cluster !\u003c/p\u003e\n\u003ch2 id=\"設定-gcp\"\u003e設定 GCP\u003c/h2\u003e\n\u003cp\u003e\n \u003cimg src=\"/2023-03-12-terraform-private-gke/create-service-account.jpg\" alt=\"建立 Service Account 與 Key\"\u003e\n\n\u003c/p\u003e\n\u003ch3 id=\"建立-service-account\"\u003e建立 Service Account\u003c/h3\u003e\n\u003cp\u003e首先我們會需要先到 Google Cloud 的頁面上,建立一個 Service Account 給 Terraform 使用,位置可以參考上圖的第 1 2 3 步驟,如果你已經有 Service Account 的話,你可以跳過這個步驟。\u003c/p\u003e","tags":["kubernetes","terraform","tech"],"title":"透過 Terraform 建立私有 GKE Cluster","type":"post","url":"/post/2023-03-12-terraform-private-gke/","weight":0,"wordcount":1219},{"author":null,"categories":["reading"],"content":"","date":1664713253,"description":"","dir":"post/","excerpt_html":"","excerpt_text":"","expirydate":-62135596800,"fuzzywordcount":1700,"html":"","keywords":["alan","zhan","blog","閱讀","心得","終身","成長","lifelong","growth","固定型","成長型","思維"],"kind":"page","lang":"en","lastmod":1664713253,"objectID":"bc7222770774a74fe90450cb930deeda","permalink":"https://alanzhan.dev/en/post/2022-10-02-lifelong-growth/","publishdate":"2022-10-02T20:20:53+08:00","readingtime":4,"relpermalink":"/en/post/2022-10-02-lifelong-growth/","section":"post","summary":"\u003ch2 id=\"mindset-types\"\u003eMindset Types\u003c/h2\u003e\n\u003cp\u003eImagine 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\u0026rsquo;re very disappointed. That evening when you\u0026rsquo;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\u0026rsquo;t pick up.\u003c/p\u003e\n\u003cp\u003eHow would you think about this story?\u003c/p\u003e","tags":["reading"],"title":"Mindset: The New Psychology of Success","type":"post","url":"/en/post/2022-10-02-lifelong-growth/","weight":0,"wordcount":1672},{"author":null,"categories":["reading"],"content":"","date":1664713253,"description":"","dir":"post/","excerpt_html":"","excerpt_text":"","expirydate":-62135596800,"fuzzywordcount":3800,"html":"","keywords":["alan","zhan","blog","閱讀","心得","終身","成長","lifelong","growth","固定型","成長型","思維"],"kind":"page","lang":"zh-tw","lastmod":1664713253,"objectID":"341b8a388563f59e343d2daa3db456af","permalink":"https://alanzhan.dev/post/2022-10-02-lifelong-growth/","publishdate":"2022-10-02T20:20:53+08:00","readingtime":8,"relpermalink":"/post/2022-10-02-lifelong-growth/","section":"post","summary":"\u003ch2 id=\"思維模式\"\u003e思維模式\u003c/h2\u003e\n\u003cp\u003e你今天去上了一門對你來說是很重要的課程,而且你非常喜歡這門課。你的教授公佈了期中考的考試成績,然而你考試的成績只獲得了 60 分。你非常的失望,等到晚上準備要回家的時候,你發現你錯過了最後一班捷運,導致你必須走回家。當你感到非常生氣的時候,打電話給你最好的朋友想要傾訴,然而卻沒有打通。\u003c/p\u003e","tags":["reading"],"title":"終身成長","type":"post","url":"/post/2022-10-02-lifelong-growth/","weight":0,"wordcount":3725},{"author":null,"categories":["tech"],"content":"","date":1661864168,"description":"","dir":"post/","excerpt_html":"","excerpt_text":"","expirydate":-62135596800,"fuzzywordcount":1300,"html":"","keywords":["alan","zhan","blog","kubernetes","kubelet","pod","nod","syncloop","flow","worknode","eviction","cAdvisor"],"kind":"page","lang":"en","lastmod":1661864168,"objectID":"5540c8da98bd4266baa8733ba5d51a55","permalink":"https://alanzhan.dev/en/post/2022-08-30-kubernetes-kubelet/","publishdate":"2022-08-30T20:56:08+08:00","readingtime":6,"relpermalink":"/en/post/2022-08-30-kubernetes-kubelet/","section":"post","summary":"\u003ch1 id=\"kubelet-architecture\"\u003eKubelet Architecture\u003c/h1\u003e\n\u003cp\u003eAs shown in the kubelet internal component structure diagram below, Kubelet is composed of many internal components:\u003c/p\u003e\n\u003cul\u003e\n\u003cli\u003eKubelet 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.\u003c/li\u003e\n\u003cli\u003esyncLoop: Receives Pod updates from the API or manifest directories, sends them to podWorkers for processing, extensively using channels for async request handling.\u003c/li\u003e\n\u003cli\u003eAuxiliary managers: Such as cAdvisor, PLEG, Volume Manager, etc., handling work outside of syncLoop.\u003c/li\u003e\n\u003cli\u003eCRI: Container Runtime Interface, responsible for communicating with container runtime shims.\u003c/li\u003e\n\u003cli\u003eContainer runtimes: Such as dockershim, rkt, etc.\u003c/li\u003e\n\u003cli\u003eNetwork plugins: Currently supports CNI and kubenet.\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp\u003e\n \u003cimg src=\"/2022-08-30-kubernetes-kubelet/architecture.png\" alt=\"kubelet architecture\"\u003e\n\n\u003c/p\u003e","tags":["kubernetes","tech"],"title":"Kubernetes Core Component: Kubelet","type":"post","url":"/en/post/2022-08-30-kubernetes-kubelet/","weight":0,"wordcount":1276},{"author":null,"categories":["tech"],"content":"","date":1661864168,"description":"","dir":"post/","excerpt_html":"","excerpt_text":"","expirydate":-62135596800,"fuzzywordcount":3100,"html":"","keywords":["alan","zhan","blog","kubernetes","kubelet","pod","nod","syncloop","flow","worknode","eviction","cAdvisor"],"kind":"page","lang":"zh-tw","lastmod":1661864168,"objectID":"7a9946f244d984af07901fb7bf80161d","permalink":"https://alanzhan.dev/post/2022-08-30-kubernetes-kubelet/","publishdate":"2022-08-30T20:56:08+08:00","readingtime":6,"relpermalink":"/post/2022-08-30-kubernetes-kubelet/","section":"post","summary":"\u003ch1 id=\"kubelet-架構\"\u003eKubelet 架構\u003c/h1\u003e\n\u003cp\u003e如下 kubelet 內部組件結構圖所示,Kubelet 由許多內部組件構成:\u003c/p\u003e\n\u003cul\u003e\n\u003cli\u003eKubelet API,包括 10250 port 的認證 API、4194 port 的 cAdvisor API、10255 port 的只讀 API 以及 10248 port 的健康檢查 API 。\u003c/li\u003e\n\u003cli\u003esyncLoop:從 API 或者 manifest 目錄接收 Pod 更新,發送到 podWorkers 處理,大量使用 channel 處理來處理異步請求 。\u003c/li\u003e\n\u003cli\u003e輔助的 manager,如 cAdvisor、PLEG、Volume Manager 等,處理 syncLoop 以外的其他工作 。\u003c/li\u003e\n\u003cli\u003eCRI:容器執行引擎接口,負責與 container runtime shim 通信 。\u003c/li\u003e\n\u003cli\u003e容器執行引擎,如 dockershim、rkt 等 。\u003c/li\u003e\n\u003cli\u003e網絡插件,目前支持 CNI 和 kubenet 。\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp\u003e\n \u003cimg src=\"/2022-08-30-kubernetes-kubelet/architecture.png\" alt=\"kubelet 架構圖\"\u003e\n\n\u003c/p\u003e","tags":["kubernetes","tech"],"title":"Kubernetes 核心介紹 Kubelet","type":"post","url":"/post/2022-08-30-kubernetes-kubelet/","weight":0,"wordcount":3002},{"author":null,"categories":["algorithm"],"content":"","date":1661667775,"description":"","dir":"post/","excerpt_html":"","excerpt_text":"","expirydate":-62135596800,"fuzzywordcount":400,"html":"","keywords":["alan","zhan","blog","golang","白話解","leetcode","25","reverse","nodes","k","group","hard"],"kind":"page","lang":"en","lastmod":1661667775,"objectID":"524b998f409b892ad79530a1a3d0a2fd","permalink":"https://alanzhan.dev/en/post/2022-08-28-leetcode-25/","publishdate":"2022-08-28T14:22:55+08:00","readingtime":1,"relpermalink":"/en/post/2022-08-28-leetcode-25/","section":"post","summary":"\u003ch1 id=\"25-reverse-nodes-in-k-group\"\u003e25. Reverse Nodes in k-Group\u003c/h1\u003e\n\u003cp\u003e\u003ca href=\"https://leetcode.com/problems/reverse-nodes-in-k-group/\"\u003ehttps://leetcode.com/problems/reverse-nodes-in-k-group/\u003c/a\u003e\u003c/p\u003e\n\u003ch3\u003eHard\u003c/h3\u003e\u003chr\u003e\u003cdiv\u003e\u003cp\u003eGiven the \u003ccode\u003ehead\u003c/code\u003e of a linked list, reverse the nodes of the list \u003ccode\u003ek\u003c/code\u003e at a time, and return \u003cem\u003ethe modified list\u003c/em\u003e.\u003c/p\u003e\n\u003cp\u003e\u003ccode\u003ek\u003c/code\u003e 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 \u003ccode\u003ek\u003c/code\u003e then left-out nodes, in the end, should remain as it is.\u003c/p\u003e\n\u003cp\u003eYou may not alter the values in the list's nodes, only nodes themselves may be changed.\u003c/p\u003e","tags":["algorithm","leetcode","leetcode-hard"],"title":"Plain English Leetcode - 25 Reverse Nodes in k-Group","type":"post","url":"/en/post/2022-08-28-leetcode-25/","weight":0,"wordcount":396},{"author":null,"categories":["algorithm"],"content":"","date":1661667775,"description":"","dir":"post/","excerpt_html":"","excerpt_text":"","expirydate":-62135596800,"fuzzywordcount":500,"html":"","keywords":["alan","zhan","blog","golang","白話解","leetcode","25","reverse","nodes","k","group","hard"],"kind":"page","lang":"zh-tw","lastmod":1661667775,"objectID":"a4d46a321607ae26232552a347127dc8","permalink":"https://alanzhan.dev/post/2022-08-28-leetcode-25/","publishdate":"2022-08-28T14:22:55+08:00","readingtime":1,"relpermalink":"/post/2022-08-28-leetcode-25/","section":"post","summary":"\u003ch1 id=\"25-reverse-nodes-in-k-group\"\u003e25. Reverse Nodes in k-Group\u003c/h1\u003e\n\u003cp\u003e\u003ca href=\"https://leetcode.com/problems/reverse-nodes-in-k-group/\"\u003ehttps://leetcode.com/problems/reverse-nodes-in-k-group/\u003c/a\u003e\u003c/p\u003e\n\u003ch3\u003eHard\u003c/h3\u003e\u003chr\u003e\u003cdiv\u003e\u003cp\u003eGiven the \u003ccode\u003ehead\u003c/code\u003e of a linked list, reverse the nodes of the list \u003ccode\u003ek\u003c/code\u003e at a time, and return \u003cem\u003ethe modified list\u003c/em\u003e.\u003c/p\u003e\n\u003cp\u003e\u003ccode\u003ek\u003c/code\u003e 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 \u003ccode\u003ek\u003c/code\u003e then left-out nodes, in the end, should remain as it is.\u003c/p\u003e\n\u003cp\u003eYou may not alter the values in the list's nodes, only nodes themselves may be changed.\u003c/p\u003e","tags":["algorithm","leetcode","leetcode-hard"],"title":"白話解 Leetcode - 25 Reverse Nodes in k-Group","type":"post","url":"/post/2022-08-28-leetcode-25/","weight":0,"wordcount":484},{"author":null,"categories":["reading"],"content":null,"date":1660459266,"description":"","dir":"post/","excerpt_html":null,"excerpt_text":null,"expirydate":-62135596800,"fuzzywordcount":1200,"html":null,"keywords":["alan","zhan","blog","閱讀","心得","reading","阿甘","投資法","指數","股票","科斯托蘭尼","巴菲特","2016","股東信","指數"],"kind":"page","lang":"en","lastmod":1660459266,"objectID":"c30015921aa315b45e0e94d9d3a2d9d9","permalink":"https://alanzhan.dev/en/post/2022-08-14-forrest-gump-invest/","publishdate":"2022-08-14T14:41:06+08:00","readingtime":3,"relpermalink":"/en/post/2022-08-14-forrest-gump-invest/","section":"post","summary":"\u003cp\u003eI 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\u0026rsquo;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 \u0026ldquo;The Forrest Gump Investment Method,\u0026rdquo; which launched my journey into index investing. Today, I\u0026rsquo;d like to introduce this book.\u003c/p\u003e","tags":["reading","invest"],"title":"The Forrest Gump Investment Method","type":"post","url":"/en/post/2022-08-14-forrest-gump-invest/","weight":0,"wordcount":1130},{"author":null,"categories":["reading"],"content":null,"date":1660459266,"description":"","dir":"post/","excerpt_html":null,"excerpt_text":null,"expirydate":-62135596800,"fuzzywordcount":2400,"html":null,"keywords":["alan","zhan","blog","閱讀","心得","reading","阿甘","投資法","指數","股票","科斯托蘭尼","巴菲特","2016","股東信","指數"],"kind":"page","lang":"zh-tw","lastmod":1660459266,"objectID":"5c6bfa18d08f543d67d3af6da6ce7849","permalink":"https://alanzhan.dev/post/2022-08-14-forrest-gump-invest/","publishdate":"2022-08-14T14:41:06+08:00","readingtime":5,"relpermalink":"/post/2022-08-14-forrest-gump-invest/","section":"post","summary":"\u003cp\u003e還記得我大概在三年前,當時的我是一位股市小白,我剛才了解完畢台灣股市之後,就隨即投入股市交易,當時買的第一張股票是 中信金 2891 ,這個代碼還記得清清楚楚,但是每天上上下下波動,每天都心驚膽跳,最後按耐不住性子就出場了,幸好最後出場有賺到一點點便當錢,不是賠錢,真的是不幸中的大幸,最後在因緣際會下,接觸到阿甘投資法這本書,就此展開了我的指數投資人生,今天就來跟大家好好介紹這本書。\u003c/p\u003e","tags":["reading","invest"],"title":"阿甘投資法","type":"post","url":"/post/2022-08-14-forrest-gump-invest/","weight":0,"wordcount":2361},{"author":null,"categories":["tech"],"content":null,"date":1659182821,"description":"","dir":"post/","excerpt_html":null,"excerpt_text":null,"expirydate":-62135596800,"fuzzywordcount":700,"html":null,"keywords":["alan","zhan","blog","kubernetes","controller","manager","informer","cloud","node","eviction","leader","election"],"kind":"page","lang":"en","lastmod":1659182821,"objectID":"e038a1419b6e6f5c39a662b882f1bdc1","permalink":"https://alanzhan.dev/en/post/2022-07-30-kubenetes-controller-manager/","publishdate":"2022-07-30T20:07:01+08:00","readingtime":4,"relpermalink":"/en/post/2022-07-30-kubenetes-controller-manager/","section":"post","summary":"\u003cp\u003eController 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\u0026rsquo;s state, and driving it toward the desired state.\u003c/p\u003e\n\u003cul\u003e\n\u003cli\u003eController Manager is the brain of the cluster and the key to keeping it running.\u003c/li\u003e\n\u003cli\u003eIts role is to ensure Kubernetes follows the declarative system specification, keeping the system\u0026rsquo;s Actual State consistent with the user-defined Desired State.\u003c/li\u003e\n\u003cli\u003eController 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.\u003c/li\u003e\n\u003cli\u003eFailed controller configurations typically trigger automatic retries. Through the controller\u0026rsquo;s continuous retry mechanism, the entire cluster ensures Eventual Consistency.\u003c/li\u003e\n\u003c/ul\u003e\n\u003ch1 id=\"controller-workflow\"\u003eController Workflow\u003c/h1\u003e\n\u003cp\u003e\n \u003cimg src=\"/2022-07-30-kubenetes-controller-manager/controller-flow.png\" alt=\"\"\u003e\n\n\u003c/p\u003e","tags":["kubernetes"],"title":"Kubernetes Core Component: Controller Manager","type":"post","url":"/en/post/2022-07-30-kubenetes-controller-manager/","weight":0,"wordcount":669},{"author":null,"categories":["tech"],"content":null,"date":1659182821,"description":"","dir":"post/","excerpt_html":null,"excerpt_text":null,"expirydate":-62135596800,"fuzzywordcount":1500,"html":null,"keywords":["alan","zhan","blog","kubernetes","controller","manager","informer","cloud","node","eviction","leader","election"],"kind":"page","lang":"zh-tw","lastmod":1659182821,"objectID":"66f526a43601255f6bcb9c19a424b402","permalink":"https://alanzhan.dev/post/2022-07-30-kubenetes-controller-manager/","publishdate":"2022-07-30T20:07:01+08:00","readingtime":3,"relpermalink":"/post/2022-07-30-kubenetes-controller-manager/","section":"post","summary":"\u003cp\u003eController Manager 是 Kubernetes 集群的自動化控制中心,裡面包含了 3X 多個 Controller ,有管理 Pod 相關的、網路相關的、儲存相關的等等。大多數的 Controller 工作模式都差不多,每個 Controller 都是一個 control loop ,負責通過 api-server 監聽其相對應的資源,根據對象狀態來決定接下來的動作,使其達到預期的狀態。\u003c/p\u003e","tags":["kubernetes"],"title":"Kubernetes 核心介紹 Controller Manager","type":"post","url":"/post/2022-07-30-kubenetes-controller-manager/","weight":0,"wordcount":1470},{"author":null,"categories":["algorithm"],"content":"","date":1657722178,"description":"","dir":"post/","excerpt_html":"","excerpt_text":"","expirydate":-62135596800,"fuzzywordcount":300,"html":"","keywords":["alan","zhan","blog","golang","白話解","leetcode","easy","70","Climbing","Stairs","dp"],"kind":"page","lang":"en","lastmod":1657722178,"objectID":"075f977001743998b1f544dbed89646e","permalink":"https://alanzhan.dev/en/post/2022-07-13-leetcode-70/","publishdate":"2022-07-13T22:22:58+08:00","readingtime":1,"relpermalink":"/en/post/2022-07-13-leetcode-70/","section":"post","summary":"\u003ch1 id=\"70-climbing-stairs\"\u003e70. Climbing Stairs\u003c/h1\u003e\n\u003cp\u003e\u003ca href=\"https://leetcode.com/problems/climbing-stairs/\"\u003ehttps://leetcode.com/problems/climbing-stairs/\u003c/a\u003e\u003c/p\u003e\n\u003ch3\u003eEasy\u003c/h3\u003e\u003chr\u003e\u003cdiv\u003e\u003cp\u003eYou are climbing a staircase. It takes \u003ccode\u003en\u003c/code\u003e steps to reach the top.\u003c/p\u003e\n\u003cp\u003eEach time you can either climb \u003ccode\u003e1\u003c/code\u003e or \u003ccode\u003e2\u003c/code\u003e steps. In how many distinct ways can you climb to the top?\u003c/p\u003e\n\u003cp\u003e\u0026nbsp;\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003eExample 1:\u003c/strong\u003e\u003c/p\u003e\n\u003cpre\u003e\u003cstrong\u003eInput:\u003c/strong\u003e n = 2\n\u003cstrong\u003eOutput:\u003c/strong\u003e 2\n\u003cstrong\u003eExplanation:\u003c/strong\u003e There are two ways to climb to the top.\n1. 1 step + 1 step\n2. 2 steps\n\u003c/pre\u003e\n\u003cp\u003e\u003cstrong\u003eExample 2:\u003c/strong\u003e\u003c/p\u003e\n\u003cpre\u003e\u003cstrong\u003eInput:\u003c/strong\u003e n = 3\n\u003cstrong\u003eOutput:\u003c/strong\u003e 3\n\u003cstrong\u003eExplanation:\u003c/strong\u003e There are three ways to climb to the top.\n1. 1 step + 1 step + 1 step\n2. 1 step + 2 steps\n3. 2 steps + 1 step\n\u003c/pre\u003e\n\u003cp\u003e\u0026nbsp;\u003c/p\u003e","tags":["algorithm","leetcode","leetcode-easy","dynamic-programing"],"title":"Plain English Leetcode - 70 Climbing Stairs","type":"post","url":"/en/post/2022-07-13-leetcode-70/","weight":0,"wordcount":264},{"author":null,"categories":["algorithm"],"content":"","date":1657722178,"description":"","dir":"post/","excerpt_html":"","excerpt_text":"","expirydate":-62135596800,"fuzzywordcount":400,"html":"","keywords":["alan","zhan","blog","golang","白話解","leetcode","easy","70","Climbing","Stairs","dp"],"kind":"page","lang":"zh-tw","lastmod":1657722178,"objectID":"50c6bac1c2033c527c580f30cb743e9b","permalink":"https://alanzhan.dev/post/2022-07-13-leetcode-70/","publishdate":"2022-07-13T22:22:58+08:00","readingtime":1,"relpermalink":"/post/2022-07-13-leetcode-70/","section":"post","summary":"\u003ch1 id=\"70-climbing-stairs\"\u003e70. Climbing Stairs\u003c/h1\u003e\n\u003cp\u003e\u003ca href=\"https://leetcode.com/problems/climbing-stairs/\"\u003ehttps://leetcode.com/problems/climbing-stairs/\u003c/a\u003e\u003c/p\u003e\n\u003ch3\u003eEasy\u003c/h3\u003e\u003chr\u003e\u003cdiv\u003e\u003cp\u003eYou are climbing a staircase. It takes \u003ccode\u003en\u003c/code\u003e steps to reach the top.\u003c/p\u003e\n\u003cp\u003eEach time you can either climb \u003ccode\u003e1\u003c/code\u003e or \u003ccode\u003e2\u003c/code\u003e steps. In how many distinct ways can you climb to the top?\u003c/p\u003e\n\u003cp\u003e\u0026nbsp;\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003eExample 1:\u003c/strong\u003e\u003c/p\u003e\n\u003cpre\u003e\u003cstrong\u003eInput:\u003c/strong\u003e n = 2\n\u003cstrong\u003eOutput:\u003c/strong\u003e 2\n\u003cstrong\u003eExplanation:\u003c/strong\u003e There are two ways to climb to the top.\n1. 1 step + 1 step\n2. 2 steps\n\u003c/pre\u003e\n\u003cp\u003e\u003cstrong\u003eExample 2:\u003c/strong\u003e\u003c/p\u003e\n\u003cpre\u003e\u003cstrong\u003eInput:\u003c/strong\u003e n = 3\n\u003cstrong\u003eOutput:\u003c/strong\u003e 3\n\u003cstrong\u003eExplanation:\u003c/strong\u003e There are three ways to climb to the top.\n1. 1 step + 1 step + 1 step\n2. 1 step + 2 steps\n3. 2 steps + 1 step\n\u003c/pre\u003e\n\u003cp\u003e\u0026nbsp;\u003c/p\u003e","tags":["algorithm","leetcode","leetcode-easy","dynamic-programing"],"title":"白話解 Leetcode - 70 Climbing Stairs","type":"post","url":"/post/2022-07-13-leetcode-70/","weight":0,"wordcount":369},{"author":null,"categories":["tech"],"content":"","date":1657448351,"description":"","dir":"post/","excerpt_html":"","excerpt_text":"","expirydate":-62135596800,"fuzzywordcount":400,"html":"","keywords":["alan","zhan","blog","kubernetes","pod","node","gke","cordon","uncordon","delete","PodAntiffinity","drain","維護","故障","轉移"],"kind":"page","lang":"en","lastmod":1657448351,"objectID":"7470b3affa374dce3aaa912ba0b760cd","permalink":"https://alanzhan.dev/en/post/2022-07-10-kubernetes-cordon-drain/","publishdate":"2022-07-10T18:19:11+08:00","readingtime":1,"relpermalink":"/en/post/2022-07-10-kubernetes-cordon-drain/","section":"post","summary":"\u003cp\u003eOur 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.\u003c/p\u003e\n\u003cp\u003eThis essentially marks a Node as unschedulable, then lets Pods migrate to the expected hosts. Let\u0026rsquo;s discuss how to safely handle node failures or upgrades.\u003c/p\u003e","tags":["kubernetes","tech"],"title":"Kubernetes - Node Maintenance and Pod Migration","type":"post","url":"/en/post/2022-07-10-kubernetes-cordon-drain/","weight":0,"wordcount":317},{"author":null,"categories":["tech"],"content":"","date":1657448351,"description":"","dir":"post/","excerpt_html":"","excerpt_text":"","expirydate":-62135596800,"fuzzywordcount":800,"html":"","keywords":["alan","zhan","blog","kubernetes","pod","node","gke","cordon","uncordon","delete","PodAntiffinity","drain","維護","故障","轉移"],"kind":"page","lang":"zh-tw","lastmod":1657448351,"objectID":"45ea89fae4ed62493f846fdebb1194cf","permalink":"https://alanzhan.dev/post/2022-07-10-kubernetes-cordon-drain/","publishdate":"2022-07-10T18:19:11+08:00","readingtime":2,"relpermalink":"/post/2022-07-10-kubernetes-cordon-drain/","section":"post","summary":"\u003cp\u003e敝公司前陣子有發現有機器的資源使用率特別的低在 GKE 上,再怎麼說這些用不到的資源也是白花花的銀子啊,所以我們就新增資源更低更便宜的 Node Pool ,再搭配使用 Cordon + Drain 或者手動刪除 Pod ,讓 Pod 重新長在新的 Node Pool 上,當然在 GKE 上直接刪除舊的 Node Pool 也可以達到一樣的效果,只是我們選用了更安全的做法。\u003c/p\u003e","tags":["kubernetes","tech"],"title":"Kubernetes - Node 維護 Pod 遷移","type":"post","url":"/post/2022-07-10-kubernetes-cordon-drain/","weight":0,"wordcount":720},{"author":null,"categories":["algorithm"],"content":"","date":1656603468,"description":"","dir":"post/","excerpt_html":"","excerpt_text":"","expirydate":-62135596800,"fuzzywordcount":300,"html":"","keywords":["alan","zhan","blog","golang","白話解","leetcode","easy","69","sqrt","x","binary","search"],"kind":"page","lang":"en","lastmod":1656603468,"objectID":"9e9fba24a2ba898099a9148fe1482418","permalink":"https://alanzhan.dev/en/post/2022-06-30-leetcode-69/","publishdate":"2022-06-30T23:37:48+08:00","readingtime":1,"relpermalink":"/en/post/2022-06-30-leetcode-69/","section":"post","summary":"\u003ch1 id=\"69-sqrtx\"\u003e69. Sqrt(x)\u003c/h1\u003e\n\u003cp\u003e\u003ca href=\"https://leetcode.com/problems/sqrtx/\"\u003ehttps://leetcode.com/problems/sqrtx/\u003c/a\u003e\u003c/p\u003e\n\u003ch3\u003eEasy\u003c/h3\u003e\u003chr\u003e\u003cdiv\u003e\u003cp\u003eGiven a non-negative integer \u003ccode\u003ex\u003c/code\u003e,\u0026nbsp;compute and return \u003cem\u003ethe square root of\u003c/em\u003e \u003ccode\u003ex\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003eSince the return type\u0026nbsp;is an integer, the decimal digits are \u003cstrong\u003etruncated\u003c/strong\u003e, and only \u003cstrong\u003ethe integer part\u003c/strong\u003e of the result\u0026nbsp;is returned.\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003eNote:\u0026nbsp;\u003c/strong\u003eYou are not allowed to use any built-in exponent function or operator, such as \u003ccode\u003epow(x, 0.5)\u003c/code\u003e or\u0026nbsp;\u003ccode\u003ex ** 0.5\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003e\u0026nbsp;\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003eExample 1:\u003c/strong\u003e\u003c/p\u003e\n\u003cpre\u003e\u003cstrong\u003eInput:\u003c/strong\u003e x = 4\n\u003cstrong\u003eOutput:\u003c/strong\u003e 2\n\u003c/pre\u003e\n\u003cp\u003e\u003cstrong\u003eExample 2:\u003c/strong\u003e\u003c/p\u003e\n\u003cpre\u003e\u003cstrong\u003eInput:\u003c/strong\u003e x = 8\n\u003cstrong\u003eOutput:\u003c/strong\u003e 2\n\u003cstrong\u003eExplanation:\u003c/strong\u003e The square root of 8 is 2.82842..., and since the decimal part is truncated, 2 is returned.\u003c/pre\u003e\n\u003cp\u003e\u0026nbsp;\u003c/p\u003e","tags":["algorithm","leetcode","leetcode-easy"],"title":"Plain English Leetcode - 69 Sqrt(x)","type":"post","url":"/en/post/2022-06-30-leetcode-69/","weight":0,"wordcount":230},{"author":null,"categories":["algorithm"],"content":"","date":1656603468,"description":"","dir":"post/","excerpt_html":"","excerpt_text":"","expirydate":-62135596800,"fuzzywordcount":400,"html":"","keywords":["alan","zhan","blog","golang","白話解","leetcode","easy","69","sqrt","x","binary","search"],"kind":"page","lang":"zh-tw","lastmod":1656603468,"objectID":"b80fdc9f7d290371ccf5eaf160370eaa","permalink":"https://alanzhan.dev/post/2022-06-30-leetcode-69/","publishdate":"2022-06-30T23:37:48+08:00","readingtime":1,"relpermalink":"/post/2022-06-30-leetcode-69/","section":"post","summary":"\u003ch1 id=\"69-sqrtx\"\u003e69. Sqrt(x)\u003c/h1\u003e\n\u003cp\u003e\u003ca href=\"https://leetcode.com/problems/sqrtx/\"\u003ehttps://leetcode.com/problems/sqrtx/\u003c/a\u003e\u003c/p\u003e\n\u003ch3\u003eEasy\u003c/h3\u003e\u003chr\u003e\u003cdiv\u003e\u003cp\u003eGiven a non-negative integer \u003ccode\u003ex\u003c/code\u003e,\u0026nbsp;compute and return \u003cem\u003ethe square root of\u003c/em\u003e \u003ccode\u003ex\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003eSince the return type\u0026nbsp;is an integer, the decimal digits are \u003cstrong\u003etruncated\u003c/strong\u003e, and only \u003cstrong\u003ethe integer part\u003c/strong\u003e of the result\u0026nbsp;is returned.\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003eNote:\u0026nbsp;\u003c/strong\u003eYou are not allowed to use any built-in exponent function or operator, such as \u003ccode\u003epow(x, 0.5)\u003c/code\u003e or\u0026nbsp;\u003ccode\u003ex ** 0.5\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003e\u0026nbsp;\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003eExample 1:\u003c/strong\u003e\u003c/p\u003e\n\u003cpre\u003e\u003cstrong\u003eInput:\u003c/strong\u003e x = 4\n\u003cstrong\u003eOutput:\u003c/strong\u003e 2\n\u003c/pre\u003e\n\u003cp\u003e\u003cstrong\u003eExample 2:\u003c/strong\u003e\u003c/p\u003e\n\u003cpre\u003e\u003cstrong\u003eInput:\u003c/strong\u003e x = 8\n\u003cstrong\u003eOutput:\u003c/strong\u003e 2\n\u003cstrong\u003eExplanation:\u003c/strong\u003e The square root of 8 is 2.82842..., and since the decimal part is truncated, 2 is returned.\u003c/pre\u003e\n\u003cp\u003e\u0026nbsp;\u003c/p\u003e","tags":["algorithm","leetcode","leetcode-easy"],"title":"白話解 Leetcode - 69 Sqrt(x)","type":"post","url":"/post/2022-06-30-leetcode-69/","weight":0,"wordcount":308},{"author":null,"categories":["algorithm"],"content":"","date":1656431743,"description":"","dir":"post/","excerpt_html":"","excerpt_text":"","expirydate":-62135596800,"fuzzywordcount":600,"html":"","keywords":["alan","zhan","blog","golang","白話解","leetcode","medium","433","minimum","genetic","mutation"],"kind":"page","lang":"en","lastmod":1656431743,"objectID":"a52d5a9237a00fac1b26620e1d0ed51b","permalink":"https://alanzhan.dev/en/post/2022-06-28-leetcode-433/","publishdate":"2022-06-28T23:55:43+08:00","readingtime":2,"relpermalink":"/en/post/2022-06-28-leetcode-433/","section":"post","summary":"\u003ch1 id=\"433-minimum-genetic-mutation\"\u003e433. Minimum Genetic Mutation\u003c/h1\u003e\n\u003cp\u003e\u003ca href=\"https://leetcode.com/problems/minimum-genetic-mutation/\"\u003ehttps://leetcode.com/problems/minimum-genetic-mutation/\u003c/a\u003e\u003c/p\u003e\n\u003ch3\u003eMedium\u003c/h3\u003e\u003chr\u003e\u003cdiv\u003e\u003cp\u003eA gene string can be represented by an 8-character long string, with choices from \u003ccode\u003e'A'\u003c/code\u003e, \u003ccode\u003e'C'\u003c/code\u003e, \u003ccode\u003e'G'\u003c/code\u003e, and \u003ccode\u003e'T'\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003eSuppose we need to investigate a mutation from a gene string \u003ccode\u003estart\u003c/code\u003e to a gene string \u003ccode\u003eend\u003c/code\u003e where one mutation is defined as one single character changed in the gene string.\u003c/p\u003e\n\u003cul\u003e\n\t\u003cli\u003eFor example, \u003ccode\u003e\"AACCGGTT\" --\u0026gt; \"AACCGGTA\"\u003c/code\u003e is one mutation.\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp\u003eThere is also a gene bank \u003ccode\u003ebank\u003c/code\u003e that records all the valid gene mutations. A gene must be in \u003ccode\u003ebank\u003c/code\u003e to make it a valid gene string.\u003c/p\u003e","tags":["algorithm","leetcode","leetcode-medium"],"title":"Plain English Leetcode - 433 Minimum Genetic Mutation","type":"post","url":"/en/post/2022-06-28-leetcode-433/","weight":0,"wordcount":528},{"author":null,"categories":["algorithm"],"content":"","date":1656431743,"description":"","dir":"post/","excerpt_html":"","excerpt_text":"","expirydate":-62135596800,"fuzzywordcount":900,"html":"","keywords":["alan","zhan","blog","golang","白話解","leetcode","medium","433","minimum","genetic","mutation"],"kind":"page","lang":"zh-tw","lastmod":1656431743,"objectID":"e4cd5545eebc5937267fce1388395090","permalink":"https://alanzhan.dev/post/2022-06-28-leetcode-433/","publishdate":"2022-06-28T23:55:43+08:00","readingtime":2,"relpermalink":"/post/2022-06-28-leetcode-433/","section":"post","summary":"\u003ch1 id=\"433-minimum-genetic-mutation\"\u003e433. Minimum Genetic Mutation\u003c/h1\u003e\n\u003cp\u003e\u003ca href=\"https://leetcode.com/problems/minimum-genetic-mutation/\"\u003ehttps://leetcode.com/problems/minimum-genetic-mutation/\u003c/a\u003e\u003c/p\u003e\n\u003ch3\u003eMedium\u003c/h3\u003e\u003chr\u003e\u003cdiv\u003e\u003cp\u003eA gene string can be represented by an 8-character long string, with choices from \u003ccode\u003e'A'\u003c/code\u003e, \u003ccode\u003e'C'\u003c/code\u003e, \u003ccode\u003e'G'\u003c/code\u003e, and \u003ccode\u003e'T'\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003eSuppose we need to investigate a mutation from a gene string \u003ccode\u003estart\u003c/code\u003e to a gene string \u003ccode\u003eend\u003c/code\u003e where one mutation is defined as one single character changed in the gene string.\u003c/p\u003e\n\u003cul\u003e\n\t\u003cli\u003eFor example, \u003ccode\u003e\"AACCGGTT\" --\u0026gt; \"AACCGGTA\"\u003c/code\u003e is one mutation.\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp\u003eThere is also a gene bank \u003ccode\u003ebank\u003c/code\u003e that records all the valid gene mutations. A gene must be in \u003ccode\u003ebank\u003c/code\u003e to make it a valid gene string.\u003c/p\u003e","tags":["algorithm","leetcode","leetcode-medium"],"title":"白話解 Leetcode - 433 Minimum Genetic Mutation","type":"post","url":"/post/2022-06-28-leetcode-433/","weight":0,"wordcount":824},{"author":null,"categories":["algorithm"],"content":"","date":1656170986,"description":"","dir":"post/","excerpt_html":"","excerpt_text":"","expirydate":-62135596800,"fuzzywordcount":400,"html":"","keywords":["alan","zhan","blog","golang","白話解","leetcode","hard","recursive","23","merge","k","sorted","lists"],"kind":"page","lang":"en","lastmod":1656170986,"objectID":"fd624c171ecf0f32e2faae218b45a896","permalink":"https://alanzhan.dev/en/post/2022-06-25-leetcode-23/","publishdate":"2022-06-25T23:29:46+08:00","readingtime":1,"relpermalink":"/en/post/2022-06-25-leetcode-23/","section":"post","summary":"\u003ch1 id=\"23-merge-k-sorted-lists\"\u003e23. Merge k Sorted Lists\u003c/h1\u003e\n\u003cp\u003e\u003ca href=\"https://leetcode.com/problems/merge-k-sorted-lists/\"\u003ehttps://leetcode.com/problems/merge-k-sorted-lists/\u003c/a\u003e\u003c/p\u003e\n\u003ch3\u003eHard\u003c/h3\u003e\u003chr\u003e\u003cdiv\u003e\u003cp\u003eYou are given an array of \u003ccode\u003ek\u003c/code\u003e linked-lists \u003ccode\u003elists\u003c/code\u003e, each linked-list is sorted in ascending order.\u003c/p\u003e\n\u003cp\u003e\u003cem\u003eMerge all the linked-lists into one sorted linked-list and return it.\u003c/em\u003e\u003c/p\u003e\n\u003cp\u003e\u0026nbsp;\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003eExample 1:\u003c/strong\u003e\u003c/p\u003e\n\u003cpre\u003e\u003cstrong\u003eInput:\u003c/strong\u003e lists = [[1,4,5],[1,3,4],[2,6]]\n\u003cstrong\u003eOutput:\u003c/strong\u003e [1,1,2,3,4,4,5,6]\n\u003cstrong\u003eExplanation:\u003c/strong\u003e The linked-lists are:\n[\n 1-\u0026gt;4-\u0026gt;5,\n 1-\u0026gt;3-\u0026gt;4,\n 2-\u0026gt;6\n]\nmerging them into one sorted list:\n1-\u0026gt;1-\u0026gt;2-\u0026gt;3-\u0026gt;4-\u0026gt;4-\u0026gt;5-\u0026gt;6\n\u003c/pre\u003e\n\u003cp\u003e\u003cstrong\u003eExample 2:\u003c/strong\u003e\u003c/p\u003e\n\u003cpre\u003e\u003cstrong\u003eInput:\u003c/strong\u003e lists = []\n\u003cstrong\u003eOutput:\u003c/strong\u003e []\n\u003c/pre\u003e\n\u003cp\u003e\u003cstrong\u003eExample 3:\u003c/strong\u003e\u003c/p\u003e\n\u003cpre\u003e\u003cstrong\u003eInput:\u003c/strong\u003e lists = [[]]\n\u003cstrong\u003eOutput:\u003c/strong\u003e []\n\u003c/pre\u003e\n\u003cp\u003e\u0026nbsp;\u003c/p\u003e","tags":["algorithm","leetcode","leetcode-hard"],"title":"Plain English Leetcode - 23 Merge k Sorted Lists","type":"post","url":"/en/post/2022-06-25-leetcode-23/","weight":0,"wordcount":376},{"author":null,"categories":["algorithm"],"content":"","date":1656170986,"description":"","dir":"post/","excerpt_html":"","excerpt_text":"","expirydate":-62135596800,"fuzzywordcount":600,"html":"","keywords":["alan","zhan","blog","golang","白話解","leetcode","hard","recursive","23","merge","k","sorted","lists"],"kind":"page","lang":"zh-tw","lastmod":1656170986,"objectID":"bc396cabbf4f4a0f9530d44493acf025","permalink":"https://alanzhan.dev/post/2022-06-25-leetcode-23/","publishdate":"2022-06-25T23:29:46+08:00","readingtime":2,"relpermalink":"/post/2022-06-25-leetcode-23/","section":"post","summary":"\u003ch1 id=\"23-merge-k-sorted-lists\"\u003e23. Merge k Sorted Lists\u003c/h1\u003e\n\u003cp\u003e\u003ca href=\"https://leetcode.com/problems/merge-k-sorted-lists/\"\u003ehttps://leetcode.com/problems/merge-k-sorted-lists/\u003c/a\u003e\u003c/p\u003e\n\u003ch3\u003eHard\u003c/h3\u003e\u003chr\u003e\u003cdiv\u003e\u003cp\u003eYou are given an array of \u003ccode\u003ek\u003c/code\u003e linked-lists \u003ccode\u003elists\u003c/code\u003e, each linked-list is sorted in ascending order.\u003c/p\u003e\n\u003cp\u003e\u003cem\u003eMerge all the linked-lists into one sorted linked-list and return it.\u003c/em\u003e\u003c/p\u003e\n\u003cp\u003e\u0026nbsp;\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003eExample 1:\u003c/strong\u003e\u003c/p\u003e\n\u003cpre\u003e\u003cstrong\u003eInput:\u003c/strong\u003e lists = [[1,4,5],[1,3,4],[2,6]]\n\u003cstrong\u003eOutput:\u003c/strong\u003e [1,1,2,3,4,4,5,6]\n\u003cstrong\u003eExplanation:\u003c/strong\u003e The linked-lists are:\n[\n 1-\u0026gt;4-\u0026gt;5,\n 1-\u0026gt;3-\u0026gt;4,\n 2-\u0026gt;6\n]\nmerging them into one sorted list:\n1-\u0026gt;1-\u0026gt;2-\u0026gt;3-\u0026gt;4-\u0026gt;4-\u0026gt;5-\u0026gt;6\n\u003c/pre\u003e\n\u003cp\u003e\u003cstrong\u003eExample 2:\u003c/strong\u003e\u003c/p\u003e\n\u003cpre\u003e\u003cstrong\u003eInput:\u003c/strong\u003e lists = []\n\u003cstrong\u003eOutput:\u003c/strong\u003e []\n\u003c/pre\u003e\n\u003cp\u003e\u003cstrong\u003eExample 3:\u003c/strong\u003e\u003c/p\u003e\n\u003cpre\u003e\u003cstrong\u003eInput:\u003c/strong\u003e lists = [[]]\n\u003cstrong\u003eOutput:\u003c/strong\u003e []\n\u003c/pre\u003e\n\u003cp\u003e\u0026nbsp;\u003c/p\u003e","tags":["algorithm","leetcode","leetcode-hard"],"title":"白話解 Leetcode - 23 Merge k Sorted Lists","type":"post","url":"/post/2022-06-25-leetcode-23/","weight":0,"wordcount":565},{"author":null,"categories":["algorithm"],"content":"","date":1655999413,"description":"","dir":"post/","excerpt_html":"","excerpt_text":"","expirydate":-62135596800,"fuzzywordcount":400,"html":"","keywords":["alan","zhan","blog","golang","白話解","leetcode","medium","recursive","200","islands","number"],"kind":"page","lang":"en","lastmod":1655999413,"objectID":"1f470748c55e53d2160d358fbd66bdc7","permalink":"https://alanzhan.dev/en/post/2022-06-23-leetcode-200/","publishdate":"2022-06-23T23:50:13+08:00","readingtime":1,"relpermalink":"/en/post/2022-06-23-leetcode-200/","section":"post","summary":"\u003ch1 id=\"200-number-of-islands\"\u003e200. Number of Islands\u003c/h1\u003e\n\u003cp\u003e\u003ca href=\"https://leetcode.com/problems/number-of-islands/\"\u003ehttps://leetcode.com/problems/number-of-islands/\u003c/a\u003e\u003c/p\u003e\n\u003ch3\u003eMedium\u003c/h3\u003e\u003chr\u003e\u003cdiv\u003e\u003cp\u003eGiven an \u003ccode\u003em x n\u003c/code\u003e 2D binary grid \u003ccode\u003egrid\u003c/code\u003e which represents a map of \u003ccode\u003e'1'\u003c/code\u003es (land) and \u003ccode\u003e'0'\u003c/code\u003es (water), return \u003cem\u003ethe number of islands\u003c/em\u003e.\u003c/p\u003e\n\u003cp\u003eAn \u003cstrong\u003eisland\u003c/strong\u003e 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.\u003c/p\u003e\n\u003cp\u003e\u0026nbsp;\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003eExample 1:\u003c/strong\u003e\u003c/p\u003e\n\u003cpre\u003e\u003cstrong\u003eInput:\u003c/strong\u003e grid = [\n [\"1\",\"1\",\"1\",\"1\",\"0\"],\n [\"1\",\"1\",\"0\",\"1\",\"0\"],\n [\"1\",\"1\",\"0\",\"0\",\"0\"],\n [\"0\",\"0\",\"0\",\"0\",\"0\"]\n]\n\u003cstrong\u003eOutput:\u003c/strong\u003e 1\n\u003c/pre\u003e\n\u003cp\u003e\u003cstrong\u003eExample 2:\u003c/strong\u003e\u003c/p\u003e","tags":["algorithm","leetcode","leetcode-medium"],"title":"Plain English Leetcode - 200 Number of Islands","type":"post","url":"/en/post/2022-06-23-leetcode-200/","weight":0,"wordcount":372},{"author":null,"categories":["algorithm"],"content":"","date":1655999413,"description":"","dir":"post/","excerpt_html":"","excerpt_text":"","expirydate":-62135596800,"fuzzywordcount":600,"html":"","keywords":["alan","zhan","blog","golang","白話解","leetcode","medium","recursive","200","islands","number"],"kind":"page","lang":"zh-tw","lastmod":1655999413,"objectID":"b0362537c3fd32864565280975fff25e","permalink":"https://alanzhan.dev/post/2022-06-23-leetcode-200/","publishdate":"2022-06-23T23:50:13+08:00","readingtime":2,"relpermalink":"/post/2022-06-23-leetcode-200/","section":"post","summary":"\u003ch1 id=\"200-number-of-islands\"\u003e200. Number of Islands\u003c/h1\u003e\n\u003cp\u003e\u003ca href=\"https://leetcode.com/problems/number-of-islands/\"\u003ehttps://leetcode.com/problems/number-of-islands/\u003c/a\u003e\u003c/p\u003e\n\u003ch3\u003eMedium\u003c/h3\u003e\u003chr\u003e\u003cdiv\u003e\u003cp\u003eGiven an \u003ccode\u003em x n\u003c/code\u003e 2D binary grid \u003ccode\u003egrid\u003c/code\u003e which represents a map of \u003ccode\u003e'1'\u003c/code\u003es (land) and \u003ccode\u003e'0'\u003c/code\u003es (water), return \u003cem\u003ethe number of islands\u003c/em\u003e.\u003c/p\u003e\n\u003cp\u003eAn \u003cstrong\u003eisland\u003c/strong\u003e 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.\u003c/p\u003e\n\u003cp\u003e\u0026nbsp;\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003eExample 1:\u003c/strong\u003e\u003c/p\u003e\n\u003cpre\u003e\u003cstrong\u003eInput:\u003c/strong\u003e grid = [\n [\"1\",\"1\",\"1\",\"1\",\"0\"],\n [\"1\",\"1\",\"0\",\"1\",\"0\"],\n [\"1\",\"1\",\"0\",\"0\",\"0\"],\n [\"0\",\"0\",\"0\",\"0\",\"0\"]\n]\n\u003cstrong\u003eOutput:\u003c/strong\u003e 1\n\u003c/pre\u003e\n\u003cp\u003e\u003cstrong\u003eExample 2:\u003c/strong\u003e\u003c/p\u003e","tags":["algorithm","leetcode","leetcode-medium"],"title":"白話解 Leetcode - 200 Number of Islands","type":"post","url":"/post/2022-06-23-leetcode-200/","weight":0,"wordcount":503},{"author":null,"categories":["algorithm"],"content":"","date":1655719200,"description":"","dir":"post/","excerpt_html":"","excerpt_text":"","expirydate":-62135596800,"fuzzywordcount":400,"html":"","keywords":["alan","zhan","blog","golang","白話解","leetcode","78","subsets","recursive","dfs","medium"],"kind":"page","lang":"en","lastmod":1655719200,"objectID":"5c7a030800b797ee2a816858ec323c6c","permalink":"https://alanzhan.dev/en/post/2022-06-20-leetcode-78/","publishdate":"2022-06-20T18:00:00+08:00","readingtime":1,"relpermalink":"/en/post/2022-06-20-leetcode-78/","section":"post","summary":"\u003ch1 id=\"78-subsets\"\u003e78. Subsets\u003c/h1\u003e\n\u003cp\u003e\u003ca href=\"https://leetcode.com/problems/subsets/\"\u003ehttps://leetcode.com/problems/subsets/\u003c/a\u003e\u003c/p\u003e\n\u003ch3\u003eMedium\u003c/h3\u003e\u003chr\u003e\u003cdiv\u003e\u003cp\u003eGiven an integer array \u003ccode\u003enums\u003c/code\u003e of \u003cstrong\u003eunique\u003c/strong\u003e elements, return \u003cem\u003eall possible subsets (the power set)\u003c/em\u003e.\u003c/p\u003e\n\u003cp\u003eThe solution set \u003cstrong\u003emust not\u003c/strong\u003e contain duplicate subsets. Return the solution in \u003cstrong\u003eany order\u003c/strong\u003e.\u003c/p\u003e\n\u003cp\u003e\u0026nbsp;\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003eExample 1:\u003c/strong\u003e\u003c/p\u003e\n\u003cpre\u003e\u003cstrong\u003eInput:\u003c/strong\u003e nums = [1,2,3]\n\u003cstrong\u003eOutput:\u003c/strong\u003e [[],[1],[2],[1,2],[3],[1,3],[2,3],[1,2,3]]\n\u003c/pre\u003e\n\u003cp\u003e\u003cstrong\u003eExample 2:\u003c/strong\u003e\u003c/p\u003e\n\u003cpre\u003e\u003cstrong\u003eInput:\u003c/strong\u003e nums = [0]\n\u003cstrong\u003eOutput:\u003c/strong\u003e [[],[0]]\n\u003c/pre\u003e\n\u003cp\u003e\u0026nbsp;\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003eConstraints:\u003c/strong\u003e\u003c/p\u003e\n\u003cul\u003e\n\t\u003cli\u003e\u003ccode\u003e1 \u0026lt;= nums.length \u0026lt;= 10\u003c/code\u003e\u003c/li\u003e\n\t\u003cli\u003e\u003ccode\u003e-10 \u0026lt;= nums[i] \u0026lt;= 10\u003c/code\u003e\u003c/li\u003e\n\t\u003cli\u003eAll the numbers of\u0026nbsp;\u003ccode\u003enums\u003c/code\u003e are \u003cstrong\u003eunique\u003c/strong\u003e.\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/div\u003e\n\u003chr\u003e\n\u003ch2 id=\"problem\"\u003eProblem\u003c/h2\u003e\n\u003cp\u003eGiven a numeric array, return all possible combinations of its elements.\u003c/p\u003e","tags":["algorithm","leetcode","leetcode-medium"],"title":"Plain English Leetcode - 78 Subsets","type":"post","url":"/en/post/2022-06-20-leetcode-78/","weight":0,"wordcount":300},{"author":null,"categories":["algorithm"],"content":"","date":1655719200,"description":"","dir":"post/","excerpt_html":"","excerpt_text":"","expirydate":-62135596800,"fuzzywordcount":500,"html":"","keywords":["alan","zhan","blog","golang","白話解","leetcode","78","subsets","recursive","dfs","medium"],"kind":"page","lang":"zh-tw","lastmod":1655719200,"objectID":"aaf21f1816bedbb274f782f290026e86","permalink":"https://alanzhan.dev/post/2022-06-20-leetcode-78/","publishdate":"2022-06-20T18:00:00+08:00","readingtime":1,"relpermalink":"/post/2022-06-20-leetcode-78/","section":"post","summary":"\u003ch1 id=\"78-subsets\"\u003e78. Subsets\u003c/h1\u003e\n\u003cp\u003e\u003ca href=\"https://leetcode.com/problems/subsets/\"\u003ehttps://leetcode.com/problems/subsets/\u003c/a\u003e\u003c/p\u003e\n\u003ch3\u003eMedium\u003c/h3\u003e\u003chr\u003e\u003cdiv\u003e\u003cp\u003eGiven an integer array \u003ccode\u003enums\u003c/code\u003e of \u003cstrong\u003eunique\u003c/strong\u003e elements, return \u003cem\u003eall possible subsets (the power set)\u003c/em\u003e.\u003c/p\u003e\n\u003cp\u003eThe solution set \u003cstrong\u003emust not\u003c/strong\u003e contain duplicate subsets. Return the solution in \u003cstrong\u003eany order\u003c/strong\u003e.\u003c/p\u003e\n\u003cp\u003e\u0026nbsp;\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003eExample 1:\u003c/strong\u003e\u003c/p\u003e\n\u003cpre\u003e\u003cstrong\u003eInput:\u003c/strong\u003e nums = [1,2,3]\n\u003cstrong\u003eOutput:\u003c/strong\u003e [[],[1],[2],[1,2],[3],[1,3],[2,3],[1,2,3]]\n\u003c/pre\u003e\n\u003cp\u003e\u003cstrong\u003eExample 2:\u003c/strong\u003e\u003c/p\u003e\n\u003cpre\u003e\u003cstrong\u003eInput:\u003c/strong\u003e nums = [0]\n\u003cstrong\u003eOutput:\u003c/strong\u003e [[],[0]]\n\u003c/pre\u003e\n\u003cp\u003e\u0026nbsp;\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003eConstraints:\u003c/strong\u003e\u003c/p\u003e\n\u003cul\u003e\n\t\u003cli\u003e\u003ccode\u003e1 \u0026lt;= nums.length \u0026lt;= 10\u003c/code\u003e\u003c/li\u003e\n\t\u003cli\u003e\u003ccode\u003e-10 \u0026lt;= nums[i] \u0026lt;= 10\u003c/code\u003e\u003c/li\u003e\n\t\u003cli\u003eAll the numbers of\u0026nbsp;\u003ccode\u003enums\u003c/code\u003e are \u003cstrong\u003eunique\u003c/strong\u003e.\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/div\u003e\n\u003chr\u003e\n\u003ch2 id=\"題意\"\u003e題意\u003c/h2\u003e\n\u003cp\u003e傳入一個數值陣列,將元素與元素之間的所有有可能發生的組合回傳。\u003c/p\u003e","tags":["algorithm","leetcode","leetcode-medium"],"title":"白話解 Leetcode - 78 Subsets","type":"post","url":"/post/2022-06-20-leetcode-78/","weight":0,"wordcount":451},{"author":null,"categories":["algorithm"],"content":"","date":1655373600,"description":"","dir":"post/","excerpt_html":"","excerpt_text":"","expirydate":-62135596800,"fuzzywordcount":400,"html":"","keywords":["alan","zhan","blog","golang","白話解","leetcode","111","minimum","depth","binary","tree","for","loop","easy"],"kind":"page","lang":"en","lastmod":1655373600,"objectID":"1f3b2a4962f8453e51b116f04c0dc160","permalink":"https://alanzhan.dev/en/post/2022-06-16-leetcode-111/","publishdate":"2022-06-16T18:00:00+08:00","readingtime":1,"relpermalink":"/en/post/2022-06-16-leetcode-111/","section":"post","summary":"\u003ch1 id=\"111-minimum-depth-of-binary-tree\"\u003e111. Minimum Depth of Binary Tree\u003c/h1\u003e\n\u003cp\u003e\u003ca href=\"https://leetcode.com/problems/minimum-depth-of-binary-tree/\"\u003ehttps://leetcode.com/problems/minimum-depth-of-binary-tree/\u003c/a\u003e\u003c/p\u003e\n\u003ch3\u003eEasy\u003c/h3\u003e\u003chr\u003e\u003cdiv\u003e\u003cp\u003eGiven a binary tree, find its minimum depth.\u003c/p\u003e\n\u003cp\u003eThe minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node.\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003eNote:\u003c/strong\u003e\u0026nbsp;A leaf is a node with no children.\u003c/p\u003e\n\u003cp\u003e\u0026nbsp;\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003eExample 1:\u003c/strong\u003e\u003c/p\u003e\n\u003cimg alt=\"\" src=\"https://assets.leetcode.com/uploads/2020/10/12/ex_depth.jpg\" style=\"width: 432px; height: 302px;\"\u003e\n\u003cpre\u003e\u003cstrong\u003eInput:\u003c/strong\u003e root = [3,9,20,null,null,15,7]\n\u003cstrong\u003eOutput:\u003c/strong\u003e 2\n\u003c/pre\u003e\n\u003cp\u003e\u003cstrong\u003eExample 2:\u003c/strong\u003e\u003c/p\u003e\n\u003cpre\u003e\u003cstrong\u003eInput:\u003c/strong\u003e root = [2,null,3,null,4,null,5,null,6]\n\u003cstrong\u003eOutput:\u003c/strong\u003e 5\n\u003c/pre\u003e\n\u003cp\u003e\u0026nbsp;\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003eConstraints:\u003c/strong\u003e\u003c/p\u003e\n\u003cul\u003e\n\t\u003cli\u003eThe number of nodes in the tree is in the range \u003ccode\u003e[0, 10\u003csup\u003e5\u003c/sup\u003e]\u003c/code\u003e.\u003c/li\u003e\n\t\u003cli\u003e\u003ccode\u003e-1000 \u0026lt;= Node.val \u0026lt;= 1000\u003c/code\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/div\u003e\n\u003chr\u003e\n\u003ch2 id=\"problem\"\u003eProblem\u003c/h2\u003e\n\u003cp\u003eFind the shallowest leaf node in the tree — what is its depth?\u003c/p\u003e","tags":["algorithm","leetcode","leetcode-easy"],"title":"Plain English Leetcode - 111 Minimum Depth of Binary Tree","type":"post","url":"/en/post/2022-06-16-leetcode-111/","weight":0,"wordcount":388},{"author":null,"categories":["algorithm"],"content":"","date":1655373600,"description":"","dir":"post/","excerpt_html":"","excerpt_text":"","expirydate":-62135596800,"fuzzywordcount":600,"html":"","keywords":["alan","zhan","blog","golang","白話解","leetcode","111","minimum","depth","binary","tree","for","loop","easy"],"kind":"page","lang":"zh-tw","lastmod":1655373600,"objectID":"5b87b31156962d4a5323245b578489de","permalink":"https://alanzhan.dev/post/2022-06-16-leetcode-111/","publishdate":"2022-06-16T18:00:00+08:00","readingtime":2,"relpermalink":"/post/2022-06-16-leetcode-111/","section":"post","summary":"\u003ch1 id=\"111-minimum-depth-of-binary-tree\"\u003e111. Minimum Depth of Binary Tree\u003c/h1\u003e\n\u003cp\u003e\u003ca href=\"https://leetcode.com/problems/minimum-depth-of-binary-tree/\"\u003ehttps://leetcode.com/problems/minimum-depth-of-binary-tree/\u003c/a\u003e\u003c/p\u003e\n\u003ch3\u003eEasy\u003c/h3\u003e\u003chr\u003e\u003cdiv\u003e\u003cp\u003eGiven a binary tree, find its minimum depth.\u003c/p\u003e\n\u003cp\u003eThe minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node.\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003eNote:\u003c/strong\u003e\u0026nbsp;A leaf is a node with no children.\u003c/p\u003e\n\u003cp\u003e\u0026nbsp;\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003eExample 1:\u003c/strong\u003e\u003c/p\u003e\n\u003cimg alt=\"\" src=\"https://assets.leetcode.com/uploads/2020/10/12/ex_depth.jpg\" style=\"width: 432px; height: 302px;\"\u003e\n\u003cpre\u003e\u003cstrong\u003eInput:\u003c/strong\u003e root = [3,9,20,null,null,15,7]\n\u003cstrong\u003eOutput:\u003c/strong\u003e 2\n\u003c/pre\u003e\n\u003cp\u003e\u003cstrong\u003eExample 2:\u003c/strong\u003e\u003c/p\u003e\n\u003cpre\u003e\u003cstrong\u003eInput:\u003c/strong\u003e root = [2,null,3,null,4,null,5,null,6]\n\u003cstrong\u003eOutput:\u003c/strong\u003e 5\n\u003c/pre\u003e\n\u003cp\u003e\u0026nbsp;\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003eConstraints:\u003c/strong\u003e\u003c/p\u003e\n\u003cul\u003e\n\t\u003cli\u003eThe number of nodes in the tree is in the range \u003ccode\u003e[0, 10\u003csup\u003e5\u003c/sup\u003e]\u003c/code\u003e.\u003c/li\u003e\n\t\u003cli\u003e\u003ccode\u003e-1000 \u0026lt;= Node.val \u0026lt;= 1000\u003c/code\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/div\u003e\n\u003chr\u003e\n\u003ch2 id=\"題意\"\u003e題意\u003c/h2\u003e\n\u003cp\u003e尋找這棵樹最小的節點,他的深度為何?\u003c/p\u003e","tags":["algorithm","leetcode","leetcode-easy"],"title":"白話解 Leetcode - 111 Minimum Depth of Binary Tree","type":"post","url":"/post/2022-06-16-leetcode-111/","weight":0,"wordcount":519},{"author":null,"categories":["algorithm"],"content":"","date":1655200800,"description":"","dir":"post/","excerpt_html":"","excerpt_text":"","expirydate":-62135596800,"fuzzywordcount":400,"html":"","keywords":["alan","zhan","blog","golang","白話解","leetcode","104","maximum","depth","binary","tree","recursive","easy","dfs"],"kind":"page","lang":"en","lastmod":1655200800,"objectID":"e712c75879ed8625a1c813aee0b160c0","permalink":"https://alanzhan.dev/en/post/2022-06-14-leetcode-104/","publishdate":"2022-06-14T18:00:00+08:00","readingtime":1,"relpermalink":"/en/post/2022-06-14-leetcode-104/","section":"post","summary":"\u003ch1 id=\"104-maximum-depth-of-binary-tree\"\u003e104. Maximum Depth of Binary Tree\u003c/h1\u003e\n\u003cp\u003e\u003ca href=\"https://leetcode.com/problems/maximum-depth-of-binary-tree/\"\u003ehttps://leetcode.com/problems/maximum-depth-of-binary-tree/\u003c/a\u003e\u003c/p\u003e\n\u003ch3\u003eEasy\u003c/h3\u003e\u003chr\u003e\u003cdiv\u003e\u003cp\u003eGiven the \u003ccode\u003eroot\u003c/code\u003e of a binary tree, return \u003cem\u003eits maximum depth\u003c/em\u003e.\u003c/p\u003e\n\u003cp\u003eA binary tree's \u003cstrong\u003emaximum depth\u003c/strong\u003e\u0026nbsp;is the number of nodes along the longest path from the root node down to the farthest leaf node.\u003c/p\u003e\n\u003cp\u003e\u0026nbsp;\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003eExample 1:\u003c/strong\u003e\u003c/p\u003e\n\u003cimg alt=\"\" src=\"https://assets.leetcode.com/uploads/2020/11/26/tmp-tree.jpg\" style=\"width: 400px; height: 277px;\"\u003e\n\u003cpre\u003e\u003cstrong\u003eInput:\u003c/strong\u003e root = [3,9,20,null,null,15,7]\n\u003cstrong\u003eOutput:\u003c/strong\u003e 3\n\u003c/pre\u003e\n\u003cp\u003e\u003cstrong\u003eExample 2:\u003c/strong\u003e\u003c/p\u003e\n\u003cpre\u003e\u003cstrong\u003eInput:\u003c/strong\u003e root = [1,null,2]\n\u003cstrong\u003eOutput:\u003c/strong\u003e 2\n\u003c/pre\u003e\n\u003cp\u003e\u0026nbsp;\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003eConstraints:\u003c/strong\u003e\u003c/p\u003e\n\u003cul\u003e\n\t\u003cli\u003eThe number of nodes in the tree is in the range \u003ccode\u003e[0, 10\u003csup\u003e4\u003c/sup\u003e]\u003c/code\u003e.\u003c/li\u003e\n\t\u003cli\u003e\u003ccode\u003e-100 \u0026lt;= Node.val \u0026lt;= 100\u003c/code\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/div\u003e\n\u003chr\u003e\n\u003ch2 id=\"problem\"\u003eProblem\u003c/h2\u003e\n\u003cp\u003eFind the deepest node in the tree — what is its depth?\u003c/p\u003e","tags":["algorithm","leetcode","leetcode-easy"],"title":"Plain English Leetcode - 104 Maximum Depth of Binary Tree","type":"post","url":"/en/post/2022-06-14-leetcode-104/","weight":0,"wordcount":314},{"author":null,"categories":["algorithm"],"content":"","date":1655200800,"description":"","dir":"post/","excerpt_html":"","excerpt_text":"","expirydate":-62135596800,"fuzzywordcount":500,"html":"","keywords":["alan","zhan","blog","golang","白話解","leetcode","104","maximum","depth","binary","tree","recursive","easy","dfs"],"kind":"page","lang":"zh-tw","lastmod":1655200800,"objectID":"442d3a7004ea57ef1cc557f045164924","permalink":"https://alanzhan.dev/post/2022-06-14-leetcode-104/","publishdate":"2022-06-14T18:00:00+08:00","readingtime":1,"relpermalink":"/post/2022-06-14-leetcode-104/","section":"post","summary":"\u003ch1 id=\"104-maximum-depth-of-binary-tree\"\u003e104. Maximum Depth of Binary Tree\u003c/h1\u003e\n\u003cp\u003e\u003ca href=\"https://leetcode.com/problems/maximum-depth-of-binary-tree/\"\u003ehttps://leetcode.com/problems/maximum-depth-of-binary-tree/\u003c/a\u003e\u003c/p\u003e\n\u003ch3\u003eEasy\u003c/h3\u003e\u003chr\u003e\u003cdiv\u003e\u003cp\u003eGiven the \u003ccode\u003eroot\u003c/code\u003e of a binary tree, return \u003cem\u003eits maximum depth\u003c/em\u003e.\u003c/p\u003e\n\u003cp\u003eA binary tree's \u003cstrong\u003emaximum depth\u003c/strong\u003e\u0026nbsp;is the number of nodes along the longest path from the root node down to the farthest leaf node.\u003c/p\u003e\n\u003cp\u003e\u0026nbsp;\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003eExample 1:\u003c/strong\u003e\u003c/p\u003e\n\u003cimg alt=\"\" src=\"https://assets.leetcode.com/uploads/2020/11/26/tmp-tree.jpg\" style=\"width: 400px; height: 277px;\"\u003e\n\u003cpre\u003e\u003cstrong\u003eInput:\u003c/strong\u003e root = [3,9,20,null,null,15,7]\n\u003cstrong\u003eOutput:\u003c/strong\u003e 3\n\u003c/pre\u003e\n\u003cp\u003e\u003cstrong\u003eExample 2:\u003c/strong\u003e\u003c/p\u003e\n\u003cpre\u003e\u003cstrong\u003eInput:\u003c/strong\u003e root = [1,null,2]\n\u003cstrong\u003eOutput:\u003c/strong\u003e 2\n\u003c/pre\u003e\n\u003cp\u003e\u0026nbsp;\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003eConstraints:\u003c/strong\u003e\u003c/p\u003e\n\u003cul\u003e\n\t\u003cli\u003eThe number of nodes in the tree is in the range \u003ccode\u003e[0, 10\u003csup\u003e4\u003c/sup\u003e]\u003c/code\u003e.\u003c/li\u003e\n\t\u003cli\u003e\u003ccode\u003e-100 \u0026lt;= Node.val \u0026lt;= 100\u003c/code\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/div\u003e\n\u003chr\u003e\n\u003ch2 id=\"題意\"\u003e題意\u003c/h2\u003e\n\u003cp\u003e尋找這棵樹最深的節點,他的深度為何?\u003c/p\u003e","tags":["algorithm","leetcode","leetcode-easy"],"title":"白話解 Leetcode - 104 Maximum Depth of Binary Tree","type":"post","url":"/post/2022-06-14-leetcode-104/","weight":0,"wordcount":456},{"author":null,"categories":["reading"],"content":"","date":1655114400,"description":"","dir":"post/","excerpt_html":"","excerpt_text":"","expirydate":-62135596800,"fuzzywordcount":800,"html":"","keywords":["alan","zhan","blog","winners","take","all","贏者","全拿","職場","生存","閱讀","心得"],"kind":"page","lang":"en","lastmod":1655114400,"objectID":"998901f97489fa72147e61f42c4cda66","permalink":"https://alanzhan.dev/en/post/2022-06-13-winners-take-all/","publishdate":"2022-06-13T18:00:00+08:00","readingtime":2,"relpermalink":"/en/post/2022-06-13-winners-take-all/","section":"post","summary":"\u003cp\u003e\u0026ldquo;Winner takes all\u0026rdquo; — the meaning is pretty clear from the phrase itself, and it happens constantly in our lives. Here\u0026rsquo;s a simple example: in a democratic society, there\u0026rsquo;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.\u003c/p\u003e","tags":["reading"],"title":"How to Survive in a Winner-Take-All Workplace","type":"post","url":"/en/post/2022-06-13-winners-take-all/","weight":0,"wordcount":755},{"author":null,"categories":["reading"],"content":"","date":1655114400,"description":"","dir":"post/","excerpt_html":"","excerpt_text":"","expirydate":-62135596800,"fuzzywordcount":1500,"html":"","keywords":["alan","zhan","blog","winners","take","all","贏者","全拿","職場","生存","閱讀","心得"],"kind":"page","lang":"zh-tw","lastmod":1655114400,"objectID":"cb739275ae2a8f3985758a07f2f9c9b3","permalink":"https://alanzhan.dev/post/2022-06-13-winners-take-all/","publishdate":"2022-06-13T18:00:00+08:00","readingtime":3,"relpermalink":"/post/2022-06-13-winners-take-all/","section":"post","summary":"\u003cp\u003e贏者全拿,從字面上的大家應該就會懂了,在我們生活中也時常發生,舉一個最簡單的例子:在民主社會中,每幾年就會有一次總統大選,只有獲得最高票的那個人可以勝出擔任下一任的總統,第二名與第三名好像就沒那麼重要;在情場上,每位男生都可以去追求新垣結衣,然後最終勝出的就只為有一位,在運動場上,在公司,在任何地方,大部分的場景都是贏者全拿的。\u003c/p\u003e","tags":["reading"],"title":"如何在贏者全拿的職場中生存","type":"post","url":"/post/2022-06-13-winners-take-all/","weight":0,"wordcount":1492},{"author":null,"categories":["algorithm"],"content":"","date":1655010104,"description":"","dir":"post/","excerpt_html":"","excerpt_text":"","expirydate":-62135596800,"fuzzywordcount":300,"html":"","keywords":["alan","zhan","blog","golang","白話解","leetcode","226","invert","binary","tree","recursive","easy"],"kind":"page","lang":"en","lastmod":1655010104,"objectID":"ac4da8f9d123329db5555e90bd65a15d","permalink":"https://alanzhan.dev/en/post/2022-06-12-leetcode-226/","publishdate":"2022-06-12T13:01:44+08:00","readingtime":1,"relpermalink":"/en/post/2022-06-12-leetcode-226/","section":"post","summary":"\u003ch1 id=\"226-invert-binary-tree\"\u003e226. Invert Binary Tree\u003c/h1\u003e\n\u003cp\u003e\u003ca href=\"https://leetcode.com/problems/invert-binary-tree/\"\u003ehttps://leetcode.com/problems/invert-binary-tree/\u003c/a\u003e\u003c/p\u003e\n\u003ch3\u003eEasy\u003c/h3\u003e\u003chr\u003e\u003cdiv\u003e\u003cp\u003eGiven the \u003ccode\u003eroot\u003c/code\u003e of a binary tree, invert the tree, and return \u003cem\u003eits root\u003c/em\u003e.\u003c/p\u003e\n\u003cp\u003e\u0026nbsp;\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003eExample 1:\u003c/strong\u003e\u003c/p\u003e\n\u003cimg alt=\"\" src=\"https://assets.leetcode.com/uploads/2021/03/14/invert1-tree.jpg\" style=\"width: 500px; height: 165px;\"\u003e\n\u003cpre\u003e\u003cstrong\u003eInput:\u003c/strong\u003e root = [4,2,7,1,3,6,9]\n\u003cstrong\u003eOutput:\u003c/strong\u003e [4,7,2,9,6,3,1]\n\u003c/pre\u003e\n\u003cp\u003e\u003cstrong\u003eExample 2:\u003c/strong\u003e\u003c/p\u003e\n\u003cimg alt=\"\" src=\"https://assets.leetcode.com/uploads/2021/03/14/invert2-tree.jpg\" style=\"width: 500px; height: 120px;\"\u003e\n\u003cpre\u003e\u003cstrong\u003eInput:\u003c/strong\u003e root = [2,1,3]\n\u003cstrong\u003eOutput:\u003c/strong\u003e [2,3,1]\n\u003c/pre\u003e\n\u003cp\u003e\u003cstrong\u003eExample 3:\u003c/strong\u003e\u003c/p\u003e\n\u003cpre\u003e\u003cstrong\u003eInput:\u003c/strong\u003e root = []\n\u003cstrong\u003eOutput:\u003c/strong\u003e []\n\u003c/pre\u003e\n\u003cp\u003e\u0026nbsp;\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003eConstraints:\u003c/strong\u003e\u003c/p\u003e\n\u003cul\u003e\n\t\u003cli\u003eThe number of nodes in the tree is in the range \u003ccode\u003e[0, 100]\u003c/code\u003e.\u003c/li\u003e\n\t\u003cli\u003e\u003ccode\u003e-100 \u0026lt;= Node.val \u0026lt;= 100\u003c/code\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/div\u003e\n\u003chr\u003e\n\u003ch2 id=\"problem\"\u003eProblem\u003c/h2\u003e\n\u003cp\u003eSwap all left and right nodes of the entire tree.\u003c/p\u003e","tags":["algorithm","leetcode","leetcode-easy"],"title":"Plain English Leetcode - 226 Invert Binary Tree","type":"post","url":"/en/post/2022-06-12-leetcode-226/","weight":0,"wordcount":227},{"author":null,"categories":["algorithm"],"content":"","date":1655010104,"description":"","dir":"post/","excerpt_html":"","excerpt_text":"","expirydate":-62135596800,"fuzzywordcount":400,"html":"","keywords":["alan","zhan","blog","golang","白話解","leetcode","226","invert","binary","tree","recursive","easy"],"kind":"page","lang":"zh-tw","lastmod":1655010104,"objectID":"5250aa3286064dd37c2eecd75edbb1e4","permalink":"https://alanzhan.dev/post/2022-06-12-leetcode-226/","publishdate":"2022-06-12T13:01:44+08:00","readingtime":1,"relpermalink":"/post/2022-06-12-leetcode-226/","section":"post","summary":"\u003ch1 id=\"226-invert-binary-tree\"\u003e226. Invert Binary Tree\u003c/h1\u003e\n\u003cp\u003e\u003ca href=\"https://leetcode.com/problems/invert-binary-tree/\"\u003ehttps://leetcode.com/problems/invert-binary-tree/\u003c/a\u003e\u003c/p\u003e\n\u003ch3\u003eEasy\u003c/h3\u003e\u003chr\u003e\u003cdiv\u003e\u003cp\u003eGiven the \u003ccode\u003eroot\u003c/code\u003e of a binary tree, invert the tree, and return \u003cem\u003eits root\u003c/em\u003e.\u003c/p\u003e\n\u003cp\u003e\u0026nbsp;\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003eExample 1:\u003c/strong\u003e\u003c/p\u003e\n\u003cimg alt=\"\" src=\"https://assets.leetcode.com/uploads/2021/03/14/invert1-tree.jpg\" style=\"width: 500px; height: 165px;\"\u003e\n\u003cpre\u003e\u003cstrong\u003eInput:\u003c/strong\u003e root = [4,2,7,1,3,6,9]\n\u003cstrong\u003eOutput:\u003c/strong\u003e [4,7,2,9,6,3,1]\n\u003c/pre\u003e\n\u003cp\u003e\u003cstrong\u003eExample 2:\u003c/strong\u003e\u003c/p\u003e\n\u003cimg alt=\"\" src=\"https://assets.leetcode.com/uploads/2021/03/14/invert2-tree.jpg\" style=\"width: 500px; height: 120px;\"\u003e\n\u003cpre\u003e\u003cstrong\u003eInput:\u003c/strong\u003e root = [2,1,3]\n\u003cstrong\u003eOutput:\u003c/strong\u003e [2,3,1]\n\u003c/pre\u003e\n\u003cp\u003e\u003cstrong\u003eExample 3:\u003c/strong\u003e\u003c/p\u003e\n\u003cpre\u003e\u003cstrong\u003eInput:\u003c/strong\u003e root = []\n\u003cstrong\u003eOutput:\u003c/strong\u003e []\n\u003c/pre\u003e\n\u003cp\u003e\u0026nbsp;\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003eConstraints:\u003c/strong\u003e\u003c/p\u003e\n\u003cul\u003e\n\t\u003cli\u003eThe number of nodes in the tree is in the range \u003ccode\u003e[0, 100]\u003c/code\u003e.\u003c/li\u003e\n\t\u003cli\u003e\u003ccode\u003e-100 \u0026lt;= Node.val \u0026lt;= 100\u003c/code\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/div\u003e\n\u003chr\u003e\n\u003ch2 id=\"題意\"\u003e題意\u003c/h2\u003e\n\u003cp\u003e將整棵樹的所有左右節點互相對調。\u003c/p\u003e","tags":["algorithm","leetcode","leetcode-easy"],"title":"白話解 Leetcode - 226 Invert Binary Tree","type":"post","url":"/post/2022-06-12-leetcode-226/","weight":0,"wordcount":332},{"author":null,"categories":["tech"],"content":"","date":1652712048,"description":"","dir":"post/","excerpt_html":"","excerpt_text":"","expirydate":-62135596800,"fuzzywordcount":1100,"html":"","keywords":["alan","zhan","blog","scheduler","controller","affinity","antiaffinity","predicate","priority","bind","nodeaffinity","podeaffinity","taints","tolerations","priorityclass"],"kind":"page","lang":"en","lastmod":1652712048,"objectID":"e279ba4f61b7078d7887c204488ea5e5","permalink":"https://alanzhan.dev/en/post/2022-05-16-kubernetes-scheduler/","publishdate":"2022-05-16T22:40:48+08:00","readingtime":5,"relpermalink":"/en/post/2022-05-16-kubernetes-scheduler/","section":"post","summary":"\u003cp\u003eStrictly speaking, the Scheduler is a special type of Controller — its working principle is no different from other controllers.\u003c/p\u003e\n\u003cp\u003eThe Scheduler\u0026rsquo;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.\u003c/p\u003e\n\u003cp\u003ekube-scheduler is responsible for assigning and scheduling Pods to nodes within the cluster. It watches kube-apiserver for Pods that haven\u0026rsquo;t been assigned to a Node, then assigns nodes to these Pods based on scheduling policies (by updating the Pod\u0026rsquo;s NodeName field).\u003c/p\u003e","tags":["kubernetes","tech"],"title":"Kubernetes Core Component: Scheduler","type":"post","url":"/en/post/2022-05-16-kubernetes-scheduler/","weight":0,"wordcount":1027},{"author":null,"categories":["tech"],"content":"","date":1652712048,"description":"","dir":"post/","excerpt_html":"","excerpt_text":"","expirydate":-62135596800,"fuzzywordcount":1900,"html":"","keywords":["alan","zhan","blog","scheduler","controller","affinity","antiaffinity","predicate","priority","bind","nodeaffinity","podeaffinity","taints","tolerations","priorityclass"],"kind":"page","lang":"zh-tw","lastmod":1652712048,"objectID":"26df0f52dd5a3905652138c90cd6a136","permalink":"https://alanzhan.dev/post/2022-05-16-kubernetes-scheduler/","publishdate":"2022-05-16T22:40:48+08:00","readingtime":4,"relpermalink":"/post/2022-05-16-kubernetes-scheduler/","section":"post","summary":"\u003cp\u003eScheduler 嚴格算起來,算是特殊的 Controller,工作原理與其他控制器無差別。\u003c/p\u003e\n\u003cp\u003eScheduler 的特殊職責在於監控當前集群所有未調度的 Pod,並且獲取當前集群的所有節點健康狀況和資源使用情控,為待調度的 Pod 選擇最佳節點,完成調度。\u003c/p\u003e","tags":["kubernetes","tech"],"title":"Kubernetes 核心介紹 Scheduler","type":"post","url":"/post/2022-05-16-kubernetes-scheduler/","weight":0,"wordcount":1800},{"author":null,"categories":["tech"],"content":"","date":1650798432,"description":"","dir":"post/","excerpt_html":"","excerpt_text":"","expirydate":-62135596800,"fuzzywordcount":1600,"html":"","keywords":["alan","zhan","blog","kubernetes","apiserver","authentication","authorization","admission","mutating","valiating","APF","FlowSchema","PriorityLevelConfiguration"],"kind":"page","lang":"en","lastmod":1650798432,"objectID":"1fcd672785fab4a5eb279814af4df766","permalink":"https://alanzhan.dev/en/post/2022-04-24-kubernetes-api-server/","publishdate":"2022-04-24T19:07:12+08:00","readingtime":8,"relpermalink":"/en/post/2022-04-24-kubernetes-api-server/","section":"post","summary":"\u003ch1 id=\"api-server\"\u003eAPI Server\u003c/h1\u003e\n\u003cp\u003ekube-apiserver is one of the most important core components of Kubernetes, providing the following key features:\u003c/p\u003e\n\u003cul\u003e\n\u003cli\u003eCluster management REST API, including authentication, authorization, data validation, and cluster state changes\n\u003cul\u003e\n\u003cli\u003eAuthentication\u003c/li\u003e\n\u003cli\u003eAuthorization\u003c/li\u003e\n\u003cli\u003eAdmission (Mutating \u0026amp; Validating)\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/li\u003e\n\u003cli\u003eActs 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.\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp\u003ekube-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\u0026rsquo;s not recommended for production environments.\u003c/p\u003e","tags":["kubernetes","tech"],"title":"Kubernetes Core Component: API Server","type":"post","url":"/en/post/2022-04-24-kubernetes-api-server/","weight":0,"wordcount":1574},{"author":null,"categories":["tech"],"content":"","date":1650798432,"description":"","dir":"post/","excerpt_html":"","excerpt_text":"","expirydate":-62135596800,"fuzzywordcount":3400,"html":"","keywords":["alan","zhan","blog","kubernetes","apiserver","authentication","authorization","admission","mutating","valiating","APF","FlowSchema","PriorityLevelConfiguration"],"kind":"page","lang":"zh-tw","lastmod":1650798432,"objectID":"a738b9835b572b60afda6954a61fb86b","permalink":"https://alanzhan.dev/post/2022-04-24-kubernetes-api-server/","publishdate":"2022-04-24T19:07:12+08:00","readingtime":7,"relpermalink":"/post/2022-04-24-kubernetes-api-server/","section":"post","summary":"\u003ch1 id=\"api-server\"\u003eAPI Server\u003c/h1\u003e\n\u003cp\u003ekube-apiserver 是 Kubernetes 最重要的核心組件之一,主要提供以下功能:\u003c/p\u003e\n\u003cul\u003e\n\u003cli\u003e提供集群管理的 REST API ,包括認證、授權、數據檢驗以及集群狀態變更等\n\u003cul\u003e\n\u003cli\u003e認證 Authentication\u003c/li\u003e\n\u003cli\u003e授權 Authorization\u003c/li\u003e\n\u003cli\u003e准入 Admission (Mutating \u0026amp; Valiating)\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/li\u003e\n\u003cli\u003e提供其他模組之間的數據交互和通訊的樞紐,其他模組只能通過 API Server 查詢或者修改數據,只有 API Server 才能直接操作 etcd。\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp\u003ekube-apiserver 支持提供 https ( 預設 port 6443 ) 和 http API (默認監聽 127.0.0.1 的 8080 ),其中 http API 是非安全的 API,不做任何認證授權機制,不建議在 Production 環境開啟此功能。\u003c/p\u003e","tags":["kubernetes","tech"],"title":"Kubernetes 核心介紹 Api Server","type":"post","url":"/post/2022-04-24-kubernetes-api-server/","weight":0,"wordcount":3399},{"author":null,"categories":["tech"],"content":"","date":1649578750,"description":"","dir":"post/","excerpt_html":"","excerpt_text":"","expirydate":-62135596800,"fuzzywordcount":800,"html":"","keywords":["alan","zhan","blog","mongo","mongodb","index","design","設計","使用","指南","best","practice","esr","rule","實踐"],"kind":"page","lang":"en","lastmod":1649578750,"objectID":"14d39bc0e98638ec4ea3436ec7fbafed","permalink":"https://alanzhan.dev/en/post/2022-04-10-mongodb-index-best-practice/","publishdate":"2022-04-10T16:19:10+08:00","readingtime":2,"relpermalink":"/en/post/2022-04-10-mongodb-index-best-practice/","section":"post","summary":"\u003cp\u003eAfter the sorted operation OOM incident in production from the previous post, I realized my understanding of MongoDB indexes wasn\u0026rsquo;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 \u003ca href=\"/en/post/2022-03-20-mongodb-sorted-operation-oom/\"\u003eMongoDB Sorted Operation OOM\u003c/a\u003e.\u003c/p\u003e\n\u003ch1 id=\"when-to-use-indexes\"\u003eWhen to Use Indexes\u003c/h1\u003e\n\u003cul\u003e\n\u003cli\u003eWhen you have sorting scenarios and in-memory sorting exceeds 32 MB.\u003c/li\u003e\n\u003cli\u003eWhen a specific field has a uniqueness requirement.\u003c/li\u003e\n\u003cli\u003eWhen the document count is large.\u003c/li\u003e\n\u003cli\u003eBuild indexes on high-cardinality fields.\u003c/li\u003e\n\u003c/ul\u003e\n\u003ch1 id=\"when-not-to-use-indexes\"\u003eWhen NOT to Use Indexes\u003c/h1\u003e\n\u003cul\u003e\n\u003cli\u003eWhen an index cannot effectively filter data.\u003c/li\u003e\n\u003cli\u003eDon\u0026rsquo;t set indexes on frequently updated fields.\u003c/li\u003e\n\u003c/ul\u003e\n\u003ch1 id=\"how-to-design-and-use-indexes\"\u003eHow to Design and Use Indexes\u003c/h1\u003e\n\u003ch2 id=\"use-compound-indexes-instead-of-single-field-indexes\"\u003eUse Compound Indexes Instead of Single Field Indexes\u003c/h2\u003e\n\u003cp\u003eIn 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.\u003c/p\u003e","tags":["mongodb","index","tech"],"title":"MongoDB Index Best Practices","type":"post","url":"/en/post/2022-04-10-mongodb-index-best-practice/","weight":0,"wordcount":703},{"author":null,"categories":["tech"],"content":"","date":1649578750,"description":"","dir":"post/","excerpt_html":"","excerpt_text":"","expirydate":-62135596800,"fuzzywordcount":1500,"html":"","keywords":["alan","zhan","blog","mongo","mongodb","index","design","設計","使用","指南","best","practice","esr","rule","實踐"],"kind":"page","lang":"zh-tw","lastmod":1649578750,"objectID":"2ceeaa175e22d4433c7158b3c313ff9b","permalink":"https://alanzhan.dev/post/2022-04-10-mongodb-index-best-practice/","publishdate":"2022-04-10T16:19:10+08:00","readingtime":3,"relpermalink":"/post/2022-04-10-mongodb-index-best-practice/","section":"post","summary":"\u003cp\u003e自上一篇在實際的 Porduction 發生了 sorted operation oom 的問題之後,才意識到自己對於 mongodb Index 的掌握度沒有那麼高,於是開始餵關鍵字給 google 查了好久才終於整理出一些重點,有一些重點在上一篇,可以到上一篇複習一下 \u003ca href=\"/post/2022-03-20-mongodb-sorted-operation-oom/\"\u003eMongoDB Sorted Operation OOM\u003c/a\u003e。\u003c/p\u003e","tags":["mongodb","index","tech"],"title":"Mongodb Index 最佳實踐","type":"post","url":"/post/2022-04-10-mongodb-index-best-practice/","weight":0,"wordcount":1499},{"author":null,"categories":["tech"],"content":"","date":1647760275,"description":"","dir":"post/","excerpt_html":"","excerpt_text":"","expirydate":-62135596800,"fuzzywordcount":700,"html":"","keywords":["alan","zhan","blog","mongo","mongodb","index","btree","sort","operation","oom","disk"],"kind":"page","lang":"en","lastmod":1647760275,"objectID":"7a20321534f1758ca9ddc9db2ab8b318","permalink":"https://alanzhan.dev/en/post/2022-03-20-mongodb-sorted-operation-oom/","publishdate":"2022-03-20T15:11:15+08:00","readingtime":4,"relpermalink":"/en/post/2022-03-20-mongodb-sorted-operation-oom/","section":"post","summary":"\u003cp\u003eThis is a rare case where I learned by working backward from a problem — I\u0026rsquo;d better document it well. Recently, our production environment hit a MongoDB sort operation limit with this specific error:\u003c/p\u003e\n\u003cp\u003eMongoDB.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.\u003c/p\u003e\n\u003cp\u003eWell, the problem has occurred. Let\u0026rsquo;s solve it first — so we added an index as an immediate fix. But what exactly is a MongoDB index?\u003c/p\u003e","tags":["mongodb","index","tech"],"title":"MongoDB Sorted Operation OOM","type":"post","url":"/en/post/2022-03-20-mongodb-sorted-operation-oom/","weight":0,"wordcount":647},{"author":null,"categories":["tech"],"content":"","date":1647760275,"description":"","dir":"post/","excerpt_html":"","excerpt_text":"","expirydate":-62135596800,"fuzzywordcount":1300,"html":"","keywords":["alan","zhan","blog","mongo","mongodb","index","btree","sort","operation","oom","disk"],"kind":"page","lang":"zh-tw","lastmod":1647760275,"objectID":"0ccad868a6b65494f2ab97ccb7af19c6","permalink":"https://alanzhan.dev/post/2022-03-20-mongodb-sorted-operation-oom/","publishdate":"2022-03-20T15:11:15+08:00","readingtime":3,"relpermalink":"/post/2022-03-20-mongodb-sorted-operation-oom/","section":"post","summary":"\u003cp\u003e這篇應該會是難得的從問題反推回去學習的歷程吧,我得好好記錄紀錄。最近我們的 production 發生了 MongoDB 的 sort 操作的限制,具體訊息如下:\u003c/p\u003e\n\u003cp\u003eMongoDB.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.\u003c/p\u003e","tags":["mongodb","index","tech"],"title":"MongoDB Sorted Operation OOM","type":"post","url":"/post/2022-03-20-mongodb-sorted-operation-oom/","weight":0,"wordcount":1210},{"author":null,"categories":["tech"],"content":"","date":1646035127,"description":"","dir":"post/","excerpt_html":"","excerpt_text":"","expirydate":-62135596800,"fuzzywordcount":1300,"html":"","keywords":["alan","zhan","blog","kubernetes","etcd","raft","leader","follower","candidate"],"kind":"page","lang":"en","lastmod":1646035127,"objectID":"2d419bf1d39100dd6499f209718d6ebe","permalink":"https://alanzhan.dev/en/post/2022-02-28-kubetnetes-etcd/","publishdate":"2022-02-28T15:58:47+08:00","readingtime":6,"relpermalink":"/en/post/2022-02-28-kubetnetes-etcd/","section":"post","summary":"\u003cp\u003eIn any system, what is the most important thing? The answer is simple: data. So I\u0026rsquo;m starting my deep dive with Kubernetes\u0026rsquo; database — etcd!\u003c/p\u003e\n\u003ch1 id=\"what-is-etcd\"\u003eWhat is etcd?\u003c/h1\u003e\n\u003cp\u003eetcd 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.).\u003c/p\u003e\n\u003cp\u003eIn 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.\u003c/p\u003e","tags":["kubernetes","tech"],"title":"Kubernetes Core Component: etcd","type":"post","url":"/en/post/2022-02-28-kubetnetes-etcd/","weight":0,"wordcount":1247},{"author":null,"categories":["tech"],"content":"","date":1646035127,"description":"","dir":"post/","excerpt_html":"","excerpt_text":"","expirydate":-62135596800,"fuzzywordcount":2500,"html":"","keywords":["alan","zhan","blog","kubernetes","etcd","raft","leader","follower","candidate"],"kind":"page","lang":"zh-tw","lastmod":1646035127,"objectID":"42a07dfa286fca92f5b3700671b7b0f7","permalink":"https://alanzhan.dev/post/2022-02-28-kubetnetes-etcd/","publishdate":"2022-02-28T15:58:47+08:00","readingtime":5,"relpermalink":"/post/2022-02-28-kubetnetes-etcd/","section":"post","summary":"\u003cp\u003e在任何一個系統中,甚麼東西會是最重要的東西呢?答案其實很簡單 : 資料,所以我就從 Kubernetes 的資料庫 etcd 開始學習起!\u003c/p\u003e\n\u003ch1 id=\"什麼是-etcd-呢\"\u003e什麼是 etcd 呢\u003c/h1\u003e\n\u003cp\u003eetcd 是 CoreOs 基於 Raft 算法開發的分散式 key-value 儲存,可用於服務發現、共享配置以及一致性保障 (如資料庫選主、分散式鎖等)。\u003c/p\u003e","tags":["kubernetes","tech"],"title":"Kubernetes 核心介紹 Etcd","type":"post","url":"/post/2022-02-28-kubetnetes-etcd/","weight":0,"wordcount":2468},{"author":null,"categories":["tech"],"content":"","date":1645340659,"description":"","dir":"post/","excerpt_html":"","excerpt_text":"","expirydate":-62135596800,"fuzzywordcount":700,"html":"","keywords":["alan","zhan","blog","kubernetes","cluster","kubeadm","cgroup","docker","flannel"],"kind":"page","lang":"en","lastmod":1645340659,"objectID":"fec5ad6631a03d2090e3e17d3921a891","permalink":"https://alanzhan.dev/en/post/2022-02-20-reinstall-kubernetes-kubeadm/","publishdate":"2022-02-20T15:04:19+08:00","readingtime":4,"relpermalink":"/en/post/2022-02-20-reinstall-kubernetes-kubeadm/","section":"post","summary":"\u003cp\u003eTo 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\u0026rsquo;t exactly smooth. This post shares the problems I encountered and how I solved them.\u003c/p\u003e\n\u003ch1 id=\"first-installation-of-kubeadm\"\u003eFirst Installation of Kubeadm\u003c/h1\u003e\n\u003col\u003e\n\u003cli\u003eInstall Ubuntu.\u003c/li\u003e\n\u003cli\u003eInstall Docker.\n\u003col\u003e\n\u003cli\u003eModify Docker\u0026rsquo;s cgroup settings to ensure the K8s and container runtime cgroup drivers match, preventing system instability.\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-bash\" data-lang=\"bash\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003esudo vim /etc/docker/daemon.json\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-json\" data-lang=\"json\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e{\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e \u003cspan style=\"color:#ff79c6\"\u003e\u0026#34;exec-opts\u0026#34;\u003c/span\u003e: [\u003cspan style=\"color:#f1fa8c\"\u003e\u0026#34;native.cgroupdriver=systemd\u0026#34;\u003c/span\u003e]\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e}\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003c/li\u003e\n\u003cli\u003eRestart Docker\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-bash\" data-lang=\"bash\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003esudo systemctl restart docker\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003c/li\u003e\n\u003c/ol\u003e\n\u003c/li\u003e\n\u003cli\u003eInstall Kubeadm.\n\u003col\u003e\n\u003cli\u003eAllow iptables to inspect bridged traffic.\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-bash\" data-lang=\"bash\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003ecat \u003cspan style=\"color:#f1fa8c\"\u003e\u0026lt;\u0026lt;EOF | sudo tee /etc/modules-load.d/k8s.conf\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#f1fa8c\"\u003ebr_netfilter\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#f1fa8c\"\u003eEOF\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003ecat \u003cspan style=\"color:#f1fa8c\"\u003e\u0026lt;\u0026lt;EOF | sudo tee /etc/sysctl.d/k8s.conf\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#f1fa8c\"\u003enet.bridge.bridge-nf-call-ip6tables = 1\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#f1fa8c\"\u003enet.bridge.bridge-nf-call-iptables = 1\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#f1fa8c\"\u003eEOF\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003esudo sysctl --system\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003c/li\u003e\n\u003cli\u003eUpdate apt and install packages required by K8s.\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-bash\" data-lang=\"bash\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003esudo apt-get update\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003esudo apt-get install -y apt-transport-https ca-certificates curl\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003c/li\u003e\n\u003cli\u003eDownload the Google Cloud public signing key.\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-bash\" data-lang=\"bash\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003esudo curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003c/li\u003e\n\u003cli\u003eAdd the K8s apt repository.\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-bash\" data-lang=\"bash\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#8be9fd;font-style:italic\"\u003eecho\u003c/span\u003e \u003cspan style=\"color:#f1fa8c\"\u003e\u0026#34;deb [signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main\u0026#34;\u003c/span\u003e | sudo tee /etc/apt/sources.list.d/kubernetes.list\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003c/li\u003e\n\u003cli\u003eUpdate the apt package index, install kubelet, kubeadm, and kubectl, and pin their versions.\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-bash\" data-lang=\"bash\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003esudo apt-get update\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003esudo apt-get install -y kubelet kubeadm kubectl\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003esudo apt-mark hold kubelet kubeadm kubectl\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003c/li\u003e\n\u003cli\u003eInitialize K8s.\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-bash\" data-lang=\"bash\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003esudo kubeadm init\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003c/li\u003e\n\u003cli\u003eJoin worker nodes\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-bash\" data-lang=\"bash\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003esudo kubeadm join 192.168.83.130:6443 --token token.... --discovery-token-ca-cert-hash sha256:......................\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003c/li\u003e\n\u003cli\u003eCopy kubeconfig\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-bash\" data-lang=\"bash\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003emkdir -p \u003cspan style=\"color:#8be9fd;font-style:italic\"\u003e$HOME\u003c/span\u003e/.kube\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003esudo cp -i /etc/kubernetes/admin.conf \u003cspan style=\"color:#8be9fd;font-style:italic\"\u003e$HOME\u003c/span\u003e/.kube/config\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003esudo chown \u003cspan style=\"color:#ff79c6\"\u003e$(\u003c/span\u003eid -u\u003cspan style=\"color:#ff79c6\"\u003e)\u003c/span\u003e:\u003cspan style=\"color:#ff79c6\"\u003e$(\u003c/span\u003eid -g\u003cspan style=\"color:#ff79c6\"\u003e)\u003c/span\u003e \u003cspan style=\"color:#8be9fd;font-style:italic\"\u003e$HOME\u003c/span\u003e/.kube/config\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003c/li\u003e\n\u003c/ol\u003e\n\u003c/li\u003e\n\u003c/ol\u003e\n\u003ch2 id=\"k8s-nodes-not-ready\"\u003eK8s Nodes Not Ready\u003c/h2\u003e\n\u003cp\u003eI 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.\u003c/p\u003e","tags":["kubernetes","tech"],"title":"Installing Kubernetes with Kubeadm - Twice","type":"post","url":"/en/post/2022-02-20-reinstall-kubernetes-kubeadm/","weight":0,"wordcount":655},{"author":null,"categories":["tech"],"content":"","date":1645340659,"description":"","dir":"post/","excerpt_html":"","excerpt_text":"","expirydate":-62135596800,"fuzzywordcount":1000,"html":"","keywords":["alan","zhan","blog","kubernetes","cluster","kubeadm","cgroup","docker","flannel"],"kind":"page","lang":"zh-tw","lastmod":1645340659,"objectID":"703b1fdba23fd04c4be2044942e44a75","permalink":"https://alanzhan.dev/post/2022-02-20-reinstall-kubernetes-kubeadm/","publishdate":"2022-02-20T15:04:19+08:00","readingtime":2,"relpermalink":"/post/2022-02-20-reinstall-kubernetes-kubeadm/","section":"post","summary":"\u003cp\u003e想要透過實戰來更了解 K8s ,所以想先自架 K8s cluster,但目前市面上自建 K8s 的方式越來越多種,可以透過 minikube 、 Kubeadm 等等,想說好吧那我就挑 Kubeadm 來裝看看,但是安裝的過程不是那麼順遂,這篇就分享一下我遇到的問題跟如何解決。\u003c/p\u003e","tags":["kubernetes","tech"],"title":"安裝兩次的 Kubernetes Kubeadm","type":"post","url":"/post/2022-02-20-reinstall-kubernetes-kubeadm/","weight":0,"wordcount":996},{"author":null,"categories":["tech"],"content":"","date":1644846520,"description":"","dir":"post/","excerpt_html":"","excerpt_text":"","expirydate":-62135596800,"fuzzywordcount":900,"html":"","keywords":["alan","zhan","blog","kubernetes","architecture","k8s","docker","container","deployment","introduction","pod","service","namespace","node"],"kind":"page","lang":"en","lastmod":1644846520,"objectID":"3fdf2c810cc39f05506e53ab71fd7ee9","permalink":"https://alanzhan.dev/en/post/2022-02-14-kubernetes-introduction/","publishdate":"2022-02-14T21:48:40+08:00","readingtime":4,"relpermalink":"/en/post/2022-02-14-kubernetes-introduction/","section":"post","summary":"\u003cp\u003eIt\u0026rsquo;s finally time to dive deep into Kubernetes. Since Kubernetes is built with Go, I\u0026rsquo;ve already done some in-depth research on Go beforehand. I won\u0026rsquo;t be covering Docker and container technology here since I\u0026rsquo;ve already studied those extensively. If you\u0026rsquo;d like to see that content, let me know! From here on, I\u0026rsquo;ll be writing a series of articles focused on Kubernetes.\u003c/p\u003e\n\u003ch1 id=\"kubernetes\"\u003eKubernetes\u003c/h1\u003e\n\u003cp\u003eWhat is Kubernetes (K8s)? K8s is the abbreviation for Kubernetes — because there are eight letters between \u0026ldquo;K\u0026rdquo; and \u0026ldquo;s.\u0026rdquo; It\u0026rsquo;s Google\u0026rsquo;s open-source container cluster management system, the open-source version of Google\u0026rsquo;s years of large-scale container management technology called Borg. Its main features include:\u003c/p\u003e","tags":["kubernetes","tech"],"title":"Kubernetes Fundamentals","type":"post","url":"/en/post/2022-02-14-kubernetes-introduction/","weight":0,"wordcount":833},{"author":null,"categories":["tech"],"content":"","date":1644846520,"description":"","dir":"post/","excerpt_html":"","excerpt_text":"","expirydate":-62135596800,"fuzzywordcount":1700,"html":"","keywords":["alan","zhan","blog","kubernetes","architecture","k8s","docker","container","deployment","introduction","pod","service","namespace","node"],"kind":"page","lang":"zh-tw","lastmod":1644846520,"objectID":"7bfb26577cc087afd7b9a54d3e488273","permalink":"https://alanzhan.dev/post/2022-02-14-kubernetes-introduction/","publishdate":"2022-02-14T21:48:40+08:00","readingtime":4,"relpermalink":"/post/2022-02-14-kubernetes-introduction/","section":"post","summary":"\u003cp\u003e終於要來好好深入探討 Kubernetes ,因為 Kubernetes 是基於 golang 這門語言開發的,所以在稍早已經先針對 golang 深度研究了,不過對於 Docker 與 container 技術有經有深入研究過了,小弟就就不針對 Docker 技術展開了,如果也想看的話,歡迎敲碗,接下來就會好好的針對 Kubernetes 有一系列的文章介紹。\u003c/p\u003e","tags":["kubernetes","tech"],"title":"Kubernetes 基礎介紹","type":"post","url":"/post/2022-02-14-kubernetes-introduction/","weight":0,"wordcount":1625},{"author":null,"categories":["tech"],"content":"","date":1644734529,"description":"","dir":"post/","excerpt_html":"","excerpt_text":"","expirydate":-62135596800,"fuzzywordcount":2000,"html":"","keywords":["alan","zhan","blog","k8s","kubernetes","go","golang","memory","management","記憶體","內存","管理","gabage ","collection","垃圾","回收","leak","洩漏","stack","heap","堆","物件","對象","TCMalloc","Java","C#","Nodejs","Javascript","binary","sort","tree","策略","stop","wolrd"],"kind":"page","lang":"en","lastmod":1644734529,"objectID":"b6d4f2642980cf651b467f9534f78157","permalink":"https://alanzhan.dev/en/post/2022-02-13-golang-memory-management/","publishdate":"2022-02-13T14:42:09+08:00","readingtime":4,"relpermalink":"/en/post/2022-02-13-golang-memory-management/","section":"post","summary":"\u003cp\u003eA new year has arrived! After completing the analysis of \u003ca href=\"/en/post/2022-01-24-golang-goroutine/\"\u003eGolang Goroutine and GMP Model In-Depth Analysis\u003c/a\u003e, I gained a much more comprehensive understanding of the Go language. But after learning about GMP, aren\u0026rsquo;t we still missing the memory management aspect? So today, let\u0026rsquo;s dive deep into how Go manages its memory.\u003c/p\u003e\n\u003ch1 id=\"the-memory-management-debate\"\u003eThe Memory Management Debate\u003c/h1\u003e\n\u003cp\u003eWhen it comes to memory management, there\u0026rsquo;s been a long-standing debate: who should manage memory — the machine or the developer? Whether it\u0026rsquo;s machine-managed or human-managed, everyone agrees that memory management is critically important, but opinions diverge:\u003c/p\u003e","tags":["golang","tech","gc"],"title":"Golang Memory Management and GC In-Depth Analysis","type":"post","url":"/en/post/2022-02-13-golang-memory-management/","weight":0,"wordcount":1985},{"author":null,"categories":["tech"],"content":"","date":1644734529,"description":"","dir":"post/","excerpt_html":"","excerpt_text":"","expirydate":-62135596800,"fuzzywordcount":4400,"html":"","keywords":["alan","zhan","blog","k8s","kubernetes","go","golang","memory","management","記憶體","內存","管理","gabage ","collection","垃圾","回收","leak","洩漏","stack","heap","堆","物件","對象","TCMalloc","Java","C#","Nodejs","Javascript","binary","sort","tree","策略","stop","wolrd"],"kind":"page","lang":"zh-tw","lastmod":1644734529,"objectID":"9e2d25b4f99feb313e27447cb86b3061","permalink":"https://alanzhan.dev/post/2022-02-13-golang-memory-management/","publishdate":"2022-02-13T14:42:09+08:00","readingtime":9,"relpermalink":"/post/2022-02-13-golang-memory-management/","section":"post","summary":"\u003cp\u003e新的一年又到來了,在這邊祝大家虎頭虎尾,所以這個年還沒過完,我得好好的繼續整理技術文章給大家了,這樣有好的開始!\u003c/p\u003e\n\u003cp\u003e上次分析完 \u003ca href=\"/post/2022-01-24-golang-goroutine/\"\u003eGolang Goroutine 與 GMP 原理全面分析\u003c/a\u003e 之後,對 golang 這個語言有了更全面的了解,但是這些有了 GMP 的相關知識之後,是不是還缺少了記憶體管理這個面向呀?那麼今天就來好好的了解 golang 是如何管理他的記憶體吧。\u003c/p\u003e","tags":["golang","tech","gc"],"title":"Golang 記憶體管理 GC 全面解析","type":"post","url":"/post/2022-02-13-golang-memory-management/","weight":0,"wordcount":4373},{"author":null,"categories":["tech"],"content":"","date":1643027098,"description":"","dir":"post/","excerpt_html":"","excerpt_text":"","expirydate":-62135596800,"fuzzywordcount":1300,"html":"","keywords":["alan","zhan","blog","k8s","kubernetes","go","golang","gmp","原理","全面","分析","詳解","模型","goroutine","協程","線程","內核態","用戶態"],"kind":"page","lang":"en","lastmod":1643027098,"objectID":"2bd7618975c2cdc292d2289dc136ffe8","permalink":"https://alanzhan.dev/en/post/2022-01-24-golang-goroutine/","publishdate":"2022-01-24T20:24:58+08:00","readingtime":3,"relpermalink":"/en/post/2022-01-24-golang-goroutine/","section":"post","summary":"\u003cp\u003eI\u0026rsquo;ve been studying Kubernetes recently, so I need to become good friends with the Go language. While reading, I came across goroutines, but couldn\u0026rsquo;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.\u003c/p\u003e\n\u003ch1 id=\"the-origin-of-golangs-scheduler\"\u003eThe Origin of Golang\u0026rsquo;s Scheduler\u003c/h1\u003e\n\u003ch2 id=\"the-single-process-era\"\u003eThe Single-Process Era\u003c/h2\u003e\n\u003cp\u003eWe 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.\u003c/p\u003e","tags":["golang","tech"],"title":"Golang Goroutine and GMP Model In-Depth Analysis","type":"post","url":"/en/post/2022-01-24-golang-goroutine/","weight":0,"wordcount":1285},{"author":null,"categories":["tech"],"content":"","date":1643027098,"description":"","dir":"post/","excerpt_html":"","excerpt_text":"","expirydate":-62135596800,"fuzzywordcount":2800,"html":"","keywords":["alan","zhan","blog","k8s","kubernetes","go","golang","gmp","原理","全面","分析","詳解","模型","goroutine","協程","線程","內核態","用戶態"],"kind":"page","lang":"zh-tw","lastmod":1643027098,"objectID":"e75425f020cdc02f90380b3413473b81","permalink":"https://alanzhan.dev/post/2022-01-24-golang-goroutine/","publishdate":"2022-01-24T20:24:58+08:00","readingtime":6,"relpermalink":"/post/2022-01-24-golang-goroutine/","section":"post","summary":"\u003cp\u003e最近在研讀 Kubernetes ,所以得好好地跟 golang 這個語言當朋友,看著看著看到了 goroutine ,但是始終不解 goroutine 是哪來幹嘛、為何而生的?所以我們在開始深入認識 goroutine 之前,我們可能要先來認識一下歷史,這樣我們才能更全面的認識 goroutine 的原理與設計思想。\u003c/p\u003e","tags":["golang","tech"],"title":"Golang Goroutine 與 GMP 原理全面分析","type":"post","url":"/post/2022-01-24-golang-goroutine/","weight":0,"wordcount":2734},{"author":null,"categories":["tech"],"content":"","date":1642323315,"description":"","dir":"post/","excerpt_html":"","excerpt_text":"","expirydate":-62135596800,"fuzzywordcount":900,"html":"","keywords":["alan","zhan","blog","docker","dockerfile","best","practice","最佳","實踐","十個"],"kind":"page","lang":"en","lastmod":1642323315,"objectID":"7f1dd2f17d233554e871739f90edb6f7","permalink":"https://alanzhan.dev/en/post/2022-01-16-dockerfile-best-practices/","publishdate":"2022-01-16T16:55:15+08:00","readingtime":2,"relpermalink":"/en/post/2022-01-16-dockerfile-best-practices/","section":"post","summary":"\u003cp\u003eI 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.\u003c/p\u003e\n\u003ch1 id=\"containers-should-be-ephemeral\"\u003eContainers Should Be Ephemeral\u003c/h1\u003e\n\u003cp\u003eContainers built from a \u003ccode\u003eDockerfile\u003c/code\u003e should be as ephemeral as possible. \u0026ldquo;Ephemeral\u0026rdquo; here means they can be started quickly and stopped quickly.\u003c/p\u003e\n\u003ch1 id=\"understand-the-build-context\"\u003eUnderstand the Build Context\u003c/h1\u003e\n\u003cp\u003eIncluding files that aren\u0026rsquo;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.\u003c/p\u003e","tags":["docker","dockerfile","tech"],"title":"10 Dockerfile Best Practices","type":"post","url":"/en/post/2022-01-16-dockerfile-best-practices/","weight":0,"wordcount":802},{"author":null,"categories":["tech"],"content":"","date":1642323315,"description":"","dir":"post/","excerpt_html":"","excerpt_text":"","expirydate":-62135596800,"fuzzywordcount":1600,"html":"","keywords":["alan","zhan","blog","docker","dockerfile","best","practice","最佳","實踐","十個"],"kind":"page","lang":"zh-tw","lastmod":1642323315,"objectID":"03c1fcc9dcab07befd2eb0cb73ed363c","permalink":"https://alanzhan.dev/post/2022-01-16-dockerfile-best-practices/","publishdate":"2022-01-16T16:55:15+08:00","readingtime":4,"relpermalink":"/post/2022-01-16-dockerfile-best-practices/","section":"post","summary":"\u003cp\u003e最近剛好在整理 docker 的技術給自己,剛好看到 dockerfile 的最佳實踐,想順手整理上來,不料看到官方已經有最佳實踐了,那我就順手做做翻譯的工作與添增自己的見解。\u003c/p\u003e\n\u003ch1 id=\"容器應該是短暫的\"\u003e容器應該是短暫的\u003c/h1\u003e\n\u003cp\u003e通過 \u003ccode\u003eDockerfile\u003c/code\u003e 構建的鏡像所啟動的容器,應該盡可能的短暫,這邊的短暫意思是:很快速的啟動,並且很快速的終止。\u003c/p\u003e","tags":["docker","dockerfile","tech"],"title":"10 個 Dockerfile 的最佳實踐","type":"post","url":"/post/2022-01-16-dockerfile-best-practices/","weight":0,"wordcount":1509},{"author":null,"categories":["tech"],"content":"","date":1641711538,"description":"","dir":"post/","excerpt_html":"","excerpt_text":"","expirydate":-62135596800,"fuzzywordcount":300,"html":"","keywords":["alan","zhan","blog","github","domain","custom","客製","自訂","域名"],"kind":"page","lang":"zh-tw","lastmod":1641711538,"objectID":"dd6fd38c5d360d180b5c83eda2a17899","permalink":"https://alanzhan.dev/post/2022-01-09-github-pages-custom-domain/","publishdate":"2022-01-09T14:58:58+08:00","readingtime":1,"relpermalink":"/post/2022-01-09-github-pages-custom-domain/","section":"post","summary":"\u003cp\u003e最近剛好在更換域名,所以順手做一下筆記,也讓大家可以輕鬆上手,設定自己的 Github page 域名。\u003c/p\u003e\n\u003ch1 id=\"第一步購買域名\"\u003e第一步:購買域名\u003c/h1\u003e\n\u003cp\u003e先去購買自己想要的域名名稱:我是去 Google Domain 購買的,如果你有喜歡或者偏好的域名供應商,你也可以去你想要的供應商購買,本篇就以 Google Domain 為例。\u003c/p\u003e","tags":["tech"],"title":"Github Pages Custom Domain - Github Blog 自訂域名","type":"post","url":"/post/2022-01-09-github-pages-custom-domain/","weight":0,"wordcount":299},{"author":null,"categories":["tech"],"content":"","date":1641711538,"description":"","dir":"post/","excerpt_html":"","excerpt_text":"","expirydate":-62135596800,"fuzzywordcount":200,"html":"","keywords":["alan","zhan","blog","github","domain","custom","客製","自訂","域名"],"kind":"page","lang":"en","lastmod":1641711538,"objectID":"8e0f374750c1691a71919bb3eeee2eec","permalink":"https://alanzhan.dev/en/post/2022-01-09-github-pages-custom-domain/","publishdate":"2022-01-09T14:58:58+08:00","readingtime":1,"relpermalink":"/en/post/2022-01-09-github-pages-custom-domain/","section":"post","summary":"\u003cp\u003eI recently switched my domain name, so I decided to take some notes to help everyone easily set up their own GitHub Pages custom domain.\u003c/p\u003e\n\u003ch1 id=\"step-1-purchase-a-domain\"\u003eStep 1: Purchase a Domain\u003c/h1\u003e\n\u003cp\u003eFirst, 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.\u003c/p\u003e\n\u003ch1 id=\"step-2-add-a-cname-record-in-dns-settings\"\u003eStep 2: Add a CNAME Record in DNS Settings\u003c/h1\u003e\n\u003cp\u003eAfter purchasing the domain, you need to configure the DNS settings. Follow the diagram below to set things up.\u003c/p\u003e","tags":["tech"],"title":"GitHub Pages Custom Domain Setup","type":"post","url":"/en/post/2022-01-09-github-pages-custom-domain/","weight":0,"wordcount":174},{"author":null,"categories":["algorithm"],"content":"","date":1626184290,"description":"","dir":"post/","excerpt_html":"","excerpt_text":"","expirydate":-62135596800,"fuzzywordcount":400,"html":"","keywords":["interpolation","search","algorithm","C#","go","alan","zhan","blog","演算法","插補","搜尋","leetcode"],"kind":"page","lang":"en","lastmod":1626184290,"objectID":"ceb8eefd40629346b20ec2adcabd4772","permalink":"https://alanzhan.dev/en/post/2021-07-13-interpolation-search-algorithm/","publishdate":"2021-07-13T21:51:30+08:00","readingtime":1,"relpermalink":"/en/post/2021-07-13-interpolation-search-algorithm/","section":"post","summary":"\u003cp\u003eContinuing 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?\u003c/p\u003e\n\u003ch1 id=\"concept\"\u003eConcept\u003c/h1\u003e\n\u003cp\u003eInterpolation Search: This is an algorithm based on binary search. \u003ccode\u003eThe list being searched must be sorted beforehand\u003c/code\u003e, and the data distribution should ideally be \u003ccode\u003elinear\u003c/code\u003e. If the data is not linearly distributed, the search may result in O(n) performance, which could be even slower than binary search.\u003c/p\u003e","tags":["algorithm","leetcode"],"title":"Interpolation Search Algorithm","type":"post","url":"/en/post/2021-07-13-interpolation-search-algorithm/","weight":0,"wordcount":358},{"author":null,"categories":["algorithm"],"content":"","date":1626184290,"description":"","dir":"post/","excerpt_html":"","excerpt_text":"","expirydate":-62135596800,"fuzzywordcount":600,"html":"","keywords":["interpolation","search","algorithm","C#","go","alan","zhan","blog","演算法","插補","搜尋","leetcode"],"kind":"page","lang":"zh-tw","lastmod":1626184290,"objectID":"f6bb759f9b2277682cfd4ce582907bfa","permalink":"https://alanzhan.dev/post/2021-07-13-interpolation-search-algorithm/","publishdate":"2021-07-13T21:51:30+08:00","readingtime":1,"relpermalink":"/post/2021-07-13-interpolation-search-algorithm/","section":"post","summary":"\u003cp\u003e繼續使用猜數字當範例, 1 ~ 100 的數字,但是這次你已經知道結果了,你如果還是繼續使用二元搜尋法,那麼效率不會那麼好,那我們該用甚麼方式解決呢?\u003c/p\u003e\n\u003ch1 id=\"概念\"\u003e概念\u003c/h1\u003e\n\u003cp\u003e插補搜尋法 (Interpolation Search):是一個基於二元搜尋法的演算法,\u003ccode\u003e被搜尋的清單是需要事先先被排序過的\u003c/code\u003e,而且資料的分布狀態最好是呈現\u003ccode\u003e線性\u003c/code\u003e的,如果不是呈現線性分布,那麼在搜尋的過程中,將有可能會得到 O(n) 的結果,可能會比二元搜尋法還更耗時。\u003c/p\u003e","tags":["algorithm","leetcode"],"title":"Interpolation Search Algorithm - 插補搜尋法","type":"post","url":"/post/2021-07-13-interpolation-search-algorithm/","weight":0,"wordcount":501},{"author":null,"categories":["algorithm"],"content":"","date":1625986115,"description":"","dir":"post/","excerpt_html":"","excerpt_text":"","expirydate":-62135596800,"fuzzywordcount":500,"html":"","keywords":["jump","search","algorithm","C#","go","alan","zhan","blog","演算法","跳躍","搜尋","leetcode"],"kind":"page","lang":"en","lastmod":1625986115,"objectID":"bae3d27168ce863ac6b49a3a29789075","permalink":"https://alanzhan.dev/en/post/2021-07-11-jump-search-alogrithm/","publishdate":"2021-07-11T14:48:35+08:00","readingtime":1,"relpermalink":"/en/post/2021-07-11-jump-search-alogrithm/","section":"post","summary":"\u003cp\u003eContinuing with the number guessing game — can we try a different approach for numbers 1 to 100?\u003c/p\u003e\n\u003cp\u003eIf we start from the beginning and jump forward by 10 each time we don\u0026rsquo;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.\u003c/p\u003e","tags":["algorithm","leetcode"],"title":"Jump Search Algorithm","type":"post","url":"/en/post/2021-07-11-jump-search-alogrithm/","weight":0,"wordcount":468},{"author":null,"categories":["algorithm"],"content":"","date":1625986115,"description":"","dir":"post/","excerpt_html":"","excerpt_text":"","expirydate":-62135596800,"fuzzywordcount":700,"html":"","keywords":["jump","search","algorithm","C#","go","alan","zhan","blog","演算法","跳躍","搜尋","leetcode"],"kind":"page","lang":"zh-tw","lastmod":1625986115,"objectID":"14a9edc0fe84d8923989db153543385d","permalink":"https://alanzhan.dev/post/2021-07-11-jump-search-alogrithm/","publishdate":"2021-07-11T14:48:35+08:00","readingtime":2,"relpermalink":"/post/2021-07-11-jump-search-alogrithm/","section":"post","summary":"\u003cp\u003e延續猜數字遊戲,1 ~ 100 我們是不是可以換個猜法呢?\u003c/p\u003e\n\u003cp\u003e如果我們從一開始,只要每次沒猜中,我們就往後面 +10 繼續猜,直到最大值範圍值變成我們所猜的數值後,往回開始找值,這樣做,在數值較小的時候,將會更有效率。\u003c/p\u003e","tags":["algorithm","leetcode"],"title":"Jump Search Algorithm - 跳躍搜尋法","type":"post","url":"/post/2021-07-11-jump-search-alogrithm/","weight":0,"wordcount":661},{"author":null,"categories":["algorithm"],"content":"","date":1625929057,"description":"","dir":"post/","excerpt_html":"","excerpt_text":"","expirydate":-62135596800,"fuzzywordcount":400,"html":"","keywords":["alan","zhan","blog","binary","search","algorithm","C#","go","演算法","二元","搜尋","leetcode"],"kind":"page","lang":"en","lastmod":1625929057,"objectID":"b349a6b876686c87d948aaecc4bfb405","permalink":"https://alanzhan.dev/en/post/2021-07-10-binary-search-algorithm/","publishdate":"2021-07-10T22:57:37+08:00","readingtime":1,"relpermalink":"/en/post/2021-07-10-binary-search-algorithm/","section":"post","summary":"\u003cp\u003eLet\u0026rsquo;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?\u003c/p\u003e\n\u003cp\u003eThe answer is simple: you\u0026rsquo;d start by guessing 50. If it\u0026rsquo;s wrong and too high, you\u0026rsquo;d guess 25 next. If too low, you\u0026rsquo;d guess 75. And so on — each time you split the remaining range in half. What you\u0026rsquo;re using is essentially Binary Search.\u003c/p\u003e","tags":["algorithm","leetcode"],"title":"Binary Search Algorithm","type":"post","url":"/en/post/2021-07-10-binary-search-algorithm/","weight":0,"wordcount":336},{"author":null,"categories":["algorithm"],"content":"","date":1625929057,"description":"","dir":"post/","excerpt_html":"","excerpt_text":"","expirydate":-62135596800,"fuzzywordcount":500,"html":"","keywords":["alan","zhan","blog","binary","search","algorithm","C#","go","演算法","二元","搜尋","leetcode"],"kind":"page","lang":"zh-tw","lastmod":1625929057,"objectID":"06084d45c8c60380681d25f191f71bcc","permalink":"https://alanzhan.dev/post/2021-07-10-binary-search-algorithm/","publishdate":"2021-07-10T22:57:37+08:00","readingtime":1,"relpermalink":"/post/2021-07-10-binary-search-algorithm/","section":"post","summary":"\u003cp\u003e我們來玩猜數字遊戲,1 ~ 100 中的整數,你必須猜中我腦海中的數字,而且我們必須在最少的布數內猜到答案,那麼你會怎麼猜呢?\u003c/p\u003e\n\u003cp\u003e答案很簡單,你一定會從 50 開始猜,如果沒猜中的話,太高你就會從 25 開始猜,太低你就會從 75 開始猜,以此類推,你每次操作的過程,你都會從中剖一半來猜測,其實你所使用的就是 Binary Search。\u003c/p\u003e","tags":["algorithm","leetcode"],"title":"Binary Search Algorithm - 二元搜尋法","type":"post","url":"/post/2021-07-10-binary-search-algorithm/","weight":0,"wordcount":483},{"author":null,"categories":["algorithm"],"content":"","date":1625914240,"description":"","dir":"post/","excerpt_html":"","excerpt_text":"","expirydate":-62135596800,"fuzzywordcount":300,"html":"","keywords":["linear\"","search","algorithm","C#","go","alan","zhan","blog","演算法","線性","搜尋","leetcode"],"kind":"page","lang":"en","lastmod":1625914240,"objectID":"23876fe3d9dd9d5813623a59a9dae8bf","permalink":"https://alanzhan.dev/en/post/2021-07-10-linear-search-algorithm/","publishdate":"2021-07-10T18:50:40+08:00","readingtime":1,"relpermalink":"/en/post/2021-07-10-linear-search-algorithm/","section":"post","summary":"\u003cp\u003eWhen checking whether an element exists, what is the most common approach? The answer is a for or while loop. Congratulations — you\u0026rsquo;ve already learned Linear Search!\u003c/p\u003e\n\u003ch1 id=\"concept\"\u003eConcept\u003c/h1\u003e\n\u003cp\u003eLinear Search: This algorithm \u003ccode\u003evisits every element\u003c/code\u003e to check where the element is located in the array. If the element is not found, it returns -1.\u003c/p\u003e\n\u003ch1 id=\"complexity\"\u003eComplexity\u003c/h1\u003e\n\u003cul\u003e\n\u003cli\u003eTime complexity: O(n)\u003c/li\u003e\n\u003cli\u003eSpace complexity: O(1)\u003c/li\u003e\n\u003c/ul\u003e\n\u003ch1 id=\"examples\"\u003eExamples\u003c/h1\u003e\n\u003ch2 id=\"go\"\u003eGo\u003c/h2\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-go\" data-lang=\"go\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#ff79c6\"\u003epackage\u003c/span\u003e main\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#ff79c6\"\u003eimport\u003c/span\u003e \u003cspan style=\"color:#f1fa8c\"\u003e\u0026#34;fmt\u0026#34;\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#8be9fd;font-style:italic\"\u003efunc\u003c/span\u003e \u003cspan style=\"color:#50fa7b\"\u003elinearSearch\u003c/span\u003e(list []\u003cspan style=\"color:#8be9fd\"\u003eint\u003c/span\u003e, target \u003cspan style=\"color:#8be9fd\"\u003eint\u003c/span\u003e) \u003cspan style=\"color:#8be9fd\"\u003eint\u003c/span\u003e {\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e \u003cspan style=\"color:#ff79c6\"\u003efor\u003c/span\u003e i \u003cspan style=\"color:#ff79c6\"\u003e:=\u003c/span\u003e \u003cspan style=\"color:#bd93f9\"\u003e0\u003c/span\u003e; i \u0026lt; \u003cspan style=\"color:#8be9fd;font-style:italic\"\u003elen\u003c/span\u003e(list); i\u003cspan style=\"color:#ff79c6\"\u003e++\u003c/span\u003e {\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e \u003cspan style=\"color:#ff79c6\"\u003eif\u003c/span\u003e list[i] \u003cspan style=\"color:#ff79c6\"\u003e==\u003c/span\u003e target {\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e \u003cspan style=\"color:#ff79c6\"\u003ereturn\u003c/span\u003e i\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e }\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e }\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e \u003cspan style=\"color:#ff79c6\"\u003ereturn\u003c/span\u003e \u003cspan style=\"color:#ff79c6\"\u003e-\u003c/span\u003e\u003cspan style=\"color:#bd93f9\"\u003e1\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e}\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#8be9fd;font-style:italic\"\u003efunc\u003c/span\u003e \u003cspan style=\"color:#50fa7b\"\u003emain\u003c/span\u003e() {\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e fmt.\u003cspan style=\"color:#50fa7b\"\u003ePrintln\u003c/span\u003e(\u003cspan style=\"color:#50fa7b\"\u003elinearSearch\u003c/span\u003e([]\u003cspan style=\"color:#8be9fd\"\u003eint\u003c/span\u003e{\u003cspan style=\"color:#bd93f9\"\u003e1\u003c/span\u003e, \u003cspan style=\"color:#bd93f9\"\u003e2\u003c/span\u003e, \u003cspan style=\"color:#bd93f9\"\u003e3\u003c/span\u003e, \u003cspan style=\"color:#bd93f9\"\u003e4\u003c/span\u003e, \u003cspan style=\"color:#bd93f9\"\u003e5\u003c/span\u003e}, \u003cspan style=\"color:#bd93f9\"\u003e3\u003c/span\u003e)) \u003cspan style=\"color:#6272a4\"\u003e// 2\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e fmt.\u003cspan style=\"color:#50fa7b\"\u003ePrintln\u003c/span\u003e(\u003cspan style=\"color:#50fa7b\"\u003elinearSearch\u003c/span\u003e([]\u003cspan style=\"color:#8be9fd\"\u003eint\u003c/span\u003e{\u003cspan style=\"color:#bd93f9\"\u003e1\u003c/span\u003e, \u003cspan style=\"color:#bd93f9\"\u003e2\u003c/span\u003e, \u003cspan style=\"color:#bd93f9\"\u003e3\u003c/span\u003e, \u003cspan style=\"color:#bd93f9\"\u003e4\u003c/span\u003e, \u003cspan style=\"color:#bd93f9\"\u003e5\u003c/span\u003e}, \u003cspan style=\"color:#bd93f9\"\u003e6\u003c/span\u003e)) \u003cspan style=\"color:#6272a4\"\u003e// -1\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e}\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003ch2 id=\"c\"\u003eC#\u003c/h2\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-C#\" data-lang=\"C#\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#ff79c6\"\u003eclass\u003c/span\u003e \u003cspan style=\"color:#50fa7b\"\u003eAlgorithm\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e{\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e \u003cspan style=\"color:#8be9fd;font-style:italic\"\u003epublic\u003c/span\u003e \u003cspan style=\"color:#8be9fd;font-style:italic\"\u003estatic\u003c/span\u003e \u003cspan style=\"color:#8be9fd\"\u003eint\u003c/span\u003e linearSearch(\u003cspan style=\"color:#8be9fd\"\u003eint\u003c/span\u003e[] list, \u003cspan style=\"color:#8be9fd\"\u003eint\u003c/span\u003e target)\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e {\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e \u003cspan style=\"color:#ff79c6\"\u003efor\u003c/span\u003e (\u003cspan style=\"color:#8be9fd\"\u003evar\u003c/span\u003e i = \u003cspan style=\"color:#bd93f9\"\u003e0\u003c/span\u003e; i \u0026lt; list.Length; i++)\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e {\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e \u003cspan style=\"color:#ff79c6\"\u003eif\u003c/span\u003e (list[i] == target)\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e {\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e \u003cspan style=\"color:#ff79c6\"\u003ereturn\u003c/span\u003e i;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e }\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e }\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e \u003cspan style=\"color:#ff79c6\"\u003ereturn\u003c/span\u003e -\u003cspan style=\"color:#bd93f9\"\u003e1\u003c/span\u003e;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e }\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e \u003cspan style=\"color:#8be9fd;font-style:italic\"\u003epublic\u003c/span\u003e \u003cspan style=\"color:#8be9fd;font-style:italic\"\u003estatic\u003c/span\u003e \u003cspan style=\"color:#ff79c6\"\u003evoid\u003c/span\u003e Main(String[] args)\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e {\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e Console.WriteLine(linearSearch(\u003cspan style=\"color:#ff79c6\"\u003enew\u003c/span\u003e \u003cspan style=\"color:#8be9fd\"\u003eint\u003c/span\u003e[] {\u003cspan style=\"color:#bd93f9\"\u003e1\u003c/span\u003e, \u003cspan style=\"color:#bd93f9\"\u003e2\u003c/span\u003e, \u003cspan style=\"color:#bd93f9\"\u003e3\u003c/span\u003e, \u003cspan style=\"color:#bd93f9\"\u003e4\u003c/span\u003e, \u003cspan style=\"color:#bd93f9\"\u003e5\u003c/span\u003e}, \u003cspan style=\"color:#bd93f9\"\u003e3\u003c/span\u003e)); \u003cspan style=\"color:#6272a4\"\u003e// 2\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e Console.WriteLine(linearSearch(\u003cspan style=\"color:#ff79c6\"\u003enew\u003c/span\u003e \u003cspan style=\"color:#8be9fd\"\u003eint\u003c/span\u003e[] {\u003cspan style=\"color:#bd93f9\"\u003e1\u003c/span\u003e, \u003cspan style=\"color:#bd93f9\"\u003e2\u003c/span\u003e, \u003cspan style=\"color:#bd93f9\"\u003e3\u003c/span\u003e, \u003cspan style=\"color:#bd93f9\"\u003e4\u003c/span\u003e, \u003cspan style=\"color:#bd93f9\"\u003e5\u003c/span\u003e}, \u003cspan style=\"color:#bd93f9\"\u003e6\u003c/span\u003e)); \u003cspan style=\"color:#6272a4\"\u003e// -1\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e }\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e}\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eFeel free to leave a comment on my blog. Your feedback motivates me to keep writing. Thank you for reading, and let\u0026rsquo;s grow together to become better versions of ourselves.\u003c/p\u003e","tags":["algorithm","leetcode"],"title":"Linear Search Algorithm","type":"post","url":"/en/post/2021-07-10-linear-search-algorithm/","weight":0,"wordcount":207},{"author":null,"categories":["algorithm"],"content":"","date":1625914240,"description":"","dir":"post/","excerpt_html":"","excerpt_text":"","expirydate":-62135596800,"fuzzywordcount":400,"html":"","keywords":["linear\"","search","algorithm","C#","go","alan","zhan","blog","演算法","線性","搜尋","leetcode"],"kind":"page","lang":"zh-tw","lastmod":1625914240,"objectID":"b4422191c537682457677a23b06711d4","permalink":"https://alanzhan.dev/post/2021-07-10-linear-search-algorithm/","publishdate":"2021-07-10T18:50:40+08:00","readingtime":1,"relpermalink":"/post/2021-07-10-linear-search-algorithm/","section":"post","summary":"\u003cp\u003e在查找一個元素是否存在的時候,我們最常使用的方式是甚麼呢?答案是 for 或者是 while 迴圈,恭喜你!已經學習完 Linear Search 了!\u003c/p\u003e\n\u003ch1 id=\"概念\"\u003e概念\u003c/h1\u003e\n\u003cp\u003e線性搜尋 (Linear Search):這個演算法會\u003ccode\u003e訪問每個元素\u003c/code\u003e,確認元素在陣列中的哪個位置,如果找不到元素則會回傳 -1。\u003c/p\u003e","tags":["algorithm","leetcode"],"title":"Linear Search Algorithm - 線性搜尋法","type":"post","url":"/post/2021-07-10-linear-search-algorithm/","weight":0,"wordcount":302},{"author":null,"categories":["algorithm"],"content":"","date":1625673394,"description":"","dir":"post/","excerpt_html":"","excerpt_text":"","expirydate":-62135596800,"fuzzywordcount":200,"html":"","keywords":["algorithm","leetcode","divide","conquer","分而治之","演算法","alan","zhan","blog"],"kind":"page","lang":"en","lastmod":1625673394,"objectID":"0b182805fccb90f93ebc59aa4932e04f","permalink":"https://alanzhan.dev/en/post/2021-07-07-divide-and-conquer/","publishdate":"2021-07-07T23:56:34+08:00","readingtime":1,"relpermalink":"/en/post/2021-07-07-divide-and-conquer/","section":"post","summary":"\u003ch1 id=\"divide-and-conquer\"\u003eDivide and Conquer\u003c/h1\u003e\n\u003cp\u003eAs 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.\u003c/p\u003e\n\u003ch2 id=\"advantages\"\u003eAdvantages\u003c/h2\u003e\n\u003col\u003e\n\u003cli\u003eReduces the difficulty of solving the problem.\u003c/li\u003e\n\u003cli\u003eCan improve execution efficiency.\u003c/li\u003e\n\u003cli\u003eIn some cases, enables parallel processing to boost performance.\u003c/li\u003e\n\u003c/ol\u003e\n\u003ch2 id=\"steps\"\u003eSteps\u003c/h2\u003e\n\u003col\u003e\n\u003cli\u003eDivide: Break the problem into several smaller subproblems that are relatively independent and share the same form as the original problem.\u003c/li\u003e\n\u003cli\u003eConquer: If the subproblem is small enough and easy to solve, solve it directly. Otherwise, solve the subproblems recursively.\u003c/li\u003e\n\u003cli\u003eCombine: Merge the solutions of the subproblems into the solution for the original problem.\u003c/li\u003e\n\u003c/ol\u003e\n\u003cp\u003eResources:\u003c/p\u003e","tags":["algorithm","leetcode"],"title":"Divide and Conquer","type":"post","url":"/en/post/2021-07-07-divide-and-conquer/","weight":0,"wordcount":143},{"author":null,"categories":["algorithm"],"content":"","date":1625673394,"description":"","dir":"post/","excerpt_html":"","excerpt_text":"","expirydate":-62135596800,"fuzzywordcount":300,"html":"","keywords":["algorithm","leetcode","divide","conquer","分而治之","演算法","alan","zhan","blog"],"kind":"page","lang":"zh-tw","lastmod":1625673394,"objectID":"ab95932fd74f8ed5a5e2aec262b9f152","permalink":"https://alanzhan.dev/post/2021-07-07-divide-and-conquer/","publishdate":"2021-07-07T23:56:34+08:00","readingtime":1,"relpermalink":"/post/2021-07-07-divide-and-conquer/","section":"post","summary":"\u003ch1 id=\"分而治之\"\u003e分而治之\u003c/h1\u003e\n\u003cp\u003e從字面上看起來,就是把一個複雜的問題分解成兩個或者很多個相同或者相似的問題,讓小問題可以被解決,再將最終結果合併求出問題的答案。\u003c/p\u003e\n\u003ch2 id=\"優點\"\u003e優點\u003c/h2\u003e\n\u003col\u003e\n\u003cli\u003e解決問題的難度降低。\u003c/li\u003e\n\u003cli\u003e可以提升執行效率。\u003c/li\u003e\n\u003cli\u003e有些時候能夠平行處理,增進性能。\u003c/li\u003e\n\u003c/ol\u003e\n\u003ch2 id=\"使用步驟\"\u003e使用步驟\u003c/h2\u003e\n\u003col\u003e\n\u003cli\u003e分解:將一個問題分解成若干個較小的問題,相對獨立,與原先問題形式相同的子問題。\u003c/li\u003e\n\u003cli\u003e解決:若子問題規模較小並且容易解決時,就直接解決。否則,就遞迴的方式解決子問題。\u003c/li\u003e\n\u003cli\u003e合併:將個子問題的解合併成為原問題的解。\u003c/li\u003e\n\u003c/ol\u003e\n\u003cp\u003eResources:\u003c/p\u003e","tags":["algorithm","leetcode"],"title":"Divide and Conquer - 分而治之","type":"post","url":"/post/2021-07-07-divide-and-conquer/","weight":0,"wordcount":269},{"author":null,"categories":["algorithm"],"content":"","date":1625587018,"description":"","dir":"post/","excerpt_html":"","excerpt_text":"","expirydate":-62135596800,"fuzzywordcount":300,"html":"","keywords":["algorithm","leetcode","big","o","符號","演算法","alan","zhan","blog"],"kind":"page","lang":"en","lastmod":1625587018,"objectID":"740bd0f7c76ceb13ec44095d341ee799","permalink":"https://alanzhan.dev/en/post/2021-07-06-big-o-notation/","publishdate":"2021-07-06T23:56:58+08:00","readingtime":1,"relpermalink":"/en/post/2021-07-06-big-o-notation/","section":"post","summary":"\u003ch1 id=\"how-to-choose-an-algorithm-to-solve-a-problem\"\u003eHow to Choose an Algorithm to Solve a Problem\u003c/h1\u003e\n\u003cp\u003eThe same problem can be solved using different algorithms, but which one is the best? There are two metrics for evaluating an algorithm:\u003c/p\u003e\n\u003cul\u003e\n\u003cli\u003eTime complexity (time consumed)\u003c/li\u003e\n\u003cli\u003eSpace complexity (memory consumed)\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp\u003eGenerally, the less time and memory an algorithm uses, the better it is. Time complexity analysis can be further broken down into three cases:\u003c/p\u003e\n\u003cul\u003e\n\u003cli\u003eBest case: Considers the \u003ccode\u003eminimum\u003c/code\u003e number of steps the algorithm needs to execute.\u003c/li\u003e\n\u003cli\u003eWorst case: Considers the \u003ccode\u003emaximum\u003c/code\u003e number of steps the algorithm needs to execute.\u003c/li\u003e\n\u003cli\u003eAverage case: Considers the \u003ccode\u003eaverage\u003c/code\u003e number of steps the algorithm needs to execute.\u003c/li\u003e\n\u003c/ul\u003e\n\u003ch1 id=\"big-o-notation-as-a-measurement-standard\"\u003eBig O Notation as a Measurement Standard\u003c/h1\u003e\n\u003cp\u003eTypically, we focus on finding the worst case, and we usually use \u003ccode\u003eBig O notation\u003c/code\u003e — a method for evaluating algorithm efficiency that represents execution speed and typically indicates the worst-case execution time.\u003c/p\u003e","tags":["algorithm","leetcode"],"title":"Big O Notation","type":"post","url":"/en/post/2021-07-06-big-o-notation/","weight":0,"wordcount":275},{"author":null,"categories":["algorithm"],"content":"","date":1625587018,"description":"","dir":"post/","excerpt_html":"","excerpt_text":"","expirydate":-62135596800,"fuzzywordcount":600,"html":"","keywords":["algorithm","leetcode","big","o","符號","演算法","alan","zhan","blog"],"kind":"page","lang":"zh-tw","lastmod":1625587018,"objectID":"4882d7f619bb2529fa1e65041621bc11","permalink":"https://alanzhan.dev/post/2021-07-06-big-o-notation/","publishdate":"2021-07-06T23:56:58+08:00","readingtime":2,"relpermalink":"/post/2021-07-06-big-o-notation/","section":"post","summary":"\u003ch1 id=\"如何選擇演算法來解決問題\"\u003e如何選擇演算法來解決問題\u003c/h1\u003e\n\u003cp\u003e同一個問題可以用不同的演算法來解決問題,但是選擇哪一個最好?有兩個指標可以評估一個算法的好壞:\u003c/p\u003e\n\u003cul\u003e\n\u003cli\u003e時間複雜度 (花的時間)\u003c/li\u003e\n\u003cli\u003e空間複雜度 (花的記憶體)\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp\u003e所以花費的時間越少、花費的記憶體越少,通常就是越好的演算法,但是演算法的時間複雜度分析又可以細分為以下三種:\u003c/p\u003e","tags":["algorithm","leetcode"],"title":"Big O Notation - Big O 符號","type":"post","url":"/post/2021-07-06-big-o-notation/","weight":0,"wordcount":560},{"author":null,"categories":["Reading"],"content":"","date":1624704412,"description":"","dir":"post/","excerpt_html":"","excerpt_text":"","expirydate":-62135596800,"fuzzywordcount":1300,"html":"","keywords":["reading","閱讀","心得","情緒","emotional","blackmail","勒索","alan","zhan","blog"],"kind":"page","lang":"en","lastmod":1624704412,"objectID":"91300640a1d470cde746de313918135c","permalink":"https://alanzhan.dev/en/post/2021-06-26-emotional-blackmail/","publishdate":"2021-06-26T18:46:52+08:00","readingtime":3,"relpermalink":"/en/post/2021-06-26-emotional-blackmail/","section":"post","summary":"\u003ch1 id=\"what-is-emotional-blackmail\"\u003eWhat Is Emotional Blackmail?\u003c/h1\u003e\n\u003cp\u003eBefore discussing emotional blackmail, we need to understand what it actually is.\u003c/p\u003e\n\u003cp\u003eEmotional blackmailers may consciously or unconsciously use demands, threats, pressure, silence, and other direct or indirect means of \u003ccode\u003eblackmail\u003c/code\u003e 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.\u003c/p\u003e\n\u003cp\u003eTo reduce these uncomfortable feelings, the victim may comply with the blackmailer\u0026rsquo;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\u0026rsquo;s \u003ccode\u003esense of self\u003c/code\u003e is completely depleted in the process.\u003c/p\u003e","tags":["reading"],"title":"Emotional Blackmail","type":"post","url":"/en/post/2021-06-26-emotional-blackmail/","weight":0,"wordcount":1266},{"author":null,"categories":["Reading"],"content":"","date":1624704412,"description":"","dir":"post/","excerpt_html":"","excerpt_text":"","expirydate":-62135596800,"fuzzywordcount":2500,"html":"","keywords":["reading","閱讀","心得","情緒","emotional","blackmail","勒索","alan","zhan","blog"],"kind":"page","lang":"zh-tw","lastmod":1624704412,"objectID":"e5f5ed1d637dd7410d7649e55a2c888e","permalink":"https://alanzhan.dev/post/2021-06-26-emotional-blackmail/","publishdate":"2021-06-26T18:46:52+08:00","readingtime":5,"relpermalink":"/post/2021-06-26-emotional-blackmail/","section":"post","summary":"\u003ch1 id=\"什麼是情緒勒索\"\u003e什麼是情緒勒索?\u003c/h1\u003e\n\u003cp\u003e在探討情緒勒索之前,我們得先搞清楚什麼是情緒勒索?\u003c/p\u003e\n\u003cp\u003e情緒勒索者可能在有意識或者無意識當中,使用要求、威脅、施壓、沉默等間接或直接的「\u003ccode\u003e勒索\u003c/code\u003e」手段,讓被勒索者產生各種負面情緒,譬如:挫折感、罪惡感、恐懼感等等,這些感受就會在被勒索者的心中發酵造成傷害。\u003c/p\u003e","tags":["reading"],"title":"Emotional Blackmail - 情緒勒索","type":"post","url":"/post/2021-06-26-emotional-blackmail/","weight":0,"wordcount":2479},{"author":null,"categories":["Reading"],"content":"","date":1623599121,"description":"","dir":"post/","excerpt_html":"","excerpt_text":"","expirydate":-62135596800,"fuzzywordcount":700,"html":"","keywords":["reading","閱讀","心得","原子","atomic","habits","習慣","alan","zhan","blog"],"kind":"page","lang":"en","lastmod":1623599121,"objectID":"c70f5a9b4ef27226bc1b01bffd23c03f","permalink":"https://alanzhan.dev/en/post/2021-06-13-atomic-habits/","publishdate":"2021-06-13T23:45:21+08:00","readingtime":2,"relpermalink":"/en/post/2021-06-13-atomic-habits/","section":"post","summary":"\u003cp\u003e\n \u003cimg src=\"/2021-06-13-atomic-habits/2021-06-13-atomic-habits_01.png\" alt=\"Atomic Habits\"\u003e\n\n\u003c/p\u003e\n\u003ch1 id=\"compound-interest\"\u003eCompound Interest\u003c/h1\u003e\n\u003cp\u003eThe word \u0026ldquo;compound interest\u0026rdquo; runs throughout this entire book. We can say it is the eighth wonder of the world, and that would be no exaggeration.\u003c/p\u003e\n\u003cul\u003e\n\u003cli\u003eIf you improve by just 1% every day for a year (1.01 ^ 365 = 37.78), you will become 37 times better.\u003c/li\u003e\n\u003cli\u003eIf you decline by 1% every day for a year (0.99 ^ 365 = 0.03), you will decline to nearly zero.\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp\u003eSo habits are the compound interest of self-improvement.\u003c/p\u003e","tags":["reading"],"title":"Atomic Habits","type":"post","url":"/en/post/2021-06-13-atomic-habits/","weight":0,"wordcount":650},{"author":null,"categories":["Reading"],"content":"","date":1623599121,"description":"","dir":"post/","excerpt_html":"","excerpt_text":"","expirydate":-62135596800,"fuzzywordcount":1200,"html":"","keywords":["reading","閱讀","心得","原子","atomic","habits","習慣","alan","zhan","blog"],"kind":"page","lang":"zh-tw","lastmod":1623599121,"objectID":"4299a0defdf901bd9e493548cfa9bd65","permalink":"https://alanzhan.dev/post/2021-06-13-atomic-habits/","publishdate":"2021-06-13T23:45:21+08:00","readingtime":3,"relpermalink":"/post/2021-06-13-atomic-habits/","section":"post","summary":"\u003cp\u003e\n \u003cimg src=\"/2021-06-13-atomic-habits/2021-06-13-atomic-habits_01.png\" alt=\"原子習慣\"\u003e\n\n\u003c/p\u003e\n\u003ch1 id=\"複利\"\u003e複利\u003c/h1\u003e\n\u003cp\u003e「複利」這個詞貫穿了整部本書,我們可以說它是世界第八大奇蹟,一點也不為過。\u003c/p\u003e\n\u003cul\u003e\n\u003cli\u003e你每天只進步 1% ,持續了之後一年 (1.01 ^ 365 = 37.78),你將進步 37 倍。\u003c/li\u003e\n\u003cli\u003e你每天持續退步了 1% ,持續了一年 (0.99 ^ 365 = 0.03) ,你將退步到趨近 0 。\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp\u003e所以習慣就是自我改善這一件事情的複利威力。\u003c/p\u003e","tags":["reading"],"title":"Atomic Habits - 原子習慣","type":"post","url":"/post/2021-06-13-atomic-habits/","weight":0,"wordcount":1138},{"author":null,"categories":[],"content":null,"date":737222400,"description":"","dir":"about/","excerpt_html":null,"excerpt_text":null,"expirydate":-62135596800,"fuzzywordcount":300,"html":null,"keywords":["about","me","alan","zhan","blog"],"kind":"page","lang":"en","lastmod":737222400,"objectID":"c29b9617fa2d0de4785d09bf94799bfb","permalink":"https://alanzhan.dev/en/about/","publishdate":"1993-05-13T00:00:00+08:00","readingtime":1,"relpermalink":"/en/about/","section":"","summary":"\u003cp\u003eWith over 10 years of experience spanning full-stack development, backend engineering, and reliability engineering, I am deeply passionate about continuous learning. I constantly seek out new technologies to sharpen my critical thinking and solve complex challenges, driving tangible value for my team. My ultimate goal is to channel this passion into building robust, scalable products that users truly love.\u003c/p\u003e\n\u003ch1 id=\"experience\"\u003eExperience\u003c/h1\u003e\n\u003cul\u003e\n\u003cli\u003e\u003cstrong\u003e\u003ca href=\"https://opennet.tw/\"\u003eOpenNet\u003c/a\u003e\u003c/strong\u003e • \u003cstrong\u003eSenior Database Reliability Engineer\u003c/strong\u003e • Mar. 2025 ~ Present\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003e\u003ca href=\"https://opennet.tw/\"\u003eOpenNet\u003c/a\u003e\u003c/strong\u003e • \u003cstrong\u003eBackend Engineer\u003c/strong\u003e • May 2024 ~ Mar. 2025\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003e\u003ca href=\"https://opennet.tw/\"\u003eOpenNet\u003c/a\u003e\u003c/strong\u003e • \u003cstrong\u003eDevOps Engineer\u003c/strong\u003e • Oct. 2022 ~ May 2024\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003e\u003ca href=\"https://www.playsee.co/\"\u003ePlaysee\u003c/a\u003e\u003c/strong\u003e • \u003cstrong\u003eBackend Engineer\u003c/strong\u003e • Jun. 2022 ~ Sep. 2022\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003e\u003ca href=\"https://www.higgstar.com/\"\u003eHiggs\u003c/a\u003e\u003c/strong\u003e • \u003cstrong\u003eSenior Full Stack Engineer\u003c/strong\u003e • Apr. 2018 ~ Jun. 2022\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003e\u003ca href=\"https://www.iscom.com.tw/\"\u003eISCOM Online International Information Inc\u003c/a\u003e\u003c/strong\u003e • \u003cstrong\u003eSoftware Engineer\u003c/strong\u003e • Sep. 2015 ~ Mar. 2018\u003c/li\u003e\n\u003c/ul\u003e\n\u003ch1 id=\"education\"\u003eEducation\u003c/h1\u003e\n\u003cul\u003e\n\u003cli\u003e\u003cstrong\u003eNorthern Arizona University\u003c/strong\u003e • Master\u0026rsquo;s degree, Computer Information Technology • Dec. 2024 ~ Dec. 2025\n\u003cem\u003e(Skills: Project Management)\u003c/em\u003e\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003eLing Tung University\u003c/strong\u003e • Bachelor of Engineering, Computer Science and Information Engineering • Sep. 2011 ~ Jun. 2015\u003c/li\u003e\n\u003c/ul\u003e\n\u003ch1 id=\"certifications\"\u003eCertifications\u003c/h1\u003e\n\u003cul\u003e\n\u003cli\u003e\u003ca href=\"https://www.credly.com/badges/330e8387-e221-446a-ab2c-87c0634cf54b?source=linked_in_profile\"\u003eAWS Certified Solutions Architect – Associate\u003c/a\u003e • Jul. 2022 ~ Jul. 2025\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp\u003eIf you\u0026rsquo;d like to connect, discuss tech, or have any feedback on my blog, feel free to reach out via email!\u003c/p\u003e","tags":[],"title":"About Me","type":"page","url":"/en/about/","weight":0,"wordcount":200},{"author":null,"categories":[],"content":null,"date":737222400,"description":"","dir":"about/","excerpt_html":null,"excerpt_text":null,"expirydate":-62135596800,"fuzzywordcount":400,"html":null,"keywords":["about","me","alan","zhan","blog"],"kind":"page","lang":"zh-tw","lastmod":737222400,"objectID":"744ea447d16961b7d5573f762491762f","permalink":"https://alanzhan.dev/about/","publishdate":"1993-05-13T00:00:00+08:00","readingtime":1,"relpermalink":"/about/","section":"","summary":"\u003cp\u003e擁有超過 10 年的全端開發、後端工程及可靠性工程經驗,我對持續學習充滿熱忱。我不斷探索新技術以磨練批判性思維、解決複雜挑戰,為團隊創造實質價值。我的終極目標是將這份熱情化為打造穩健、可擴展且深受用戶喜愛的產品。\u003c/p\u003e","tags":[],"title":"關於我","type":"page","url":"/about/","weight":0,"wordcount":335}]