From 11ad1cd3ed0635580d139260e657cc3c7d4ee1df Mon Sep 17 00:00:00 2001 From: Invidam Date: Tue, 14 May 2024 21:11:50 +0900 Subject: [PATCH 01/10] feat: max-depth-of-bin-tree --- maximum-depth-of-binary-tree/invidam.go.md | 72 ++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 maximum-depth-of-binary-tree/invidam.go.md diff --git a/maximum-depth-of-binary-tree/invidam.go.md b/maximum-depth-of-binary-tree/invidam.go.md new file mode 100644 index 000000000..7cb6d4040 --- /dev/null +++ b/maximum-depth-of-binary-tree/invidam.go.md @@ -0,0 +1,72 @@ +# Intuition +Recursuib is a natural method for iterating trees. + +# Approach + +1. Child function can calculate the depth of its subtrees automatically. +2. Parent function only select the maximum of the two depths and return +1. (i.e. `+1` means parent's depth.) + +# Complexity +- Time complexity: $$O(n)$$ + + +- Space complexity + - $$O(logN)$$ (best case for balanced tree) + - $$O(N)$$ (worst case for skewed tree) + +(N: size of node.) +# Code +``` +func maxDepth(root *TreeNode) int { + if root == nil { + return 0 + } + return max(maxDepth(root.Left), maxDepth(root.Right)) + 1 +} +``` +- - - +# Intuition +Implement Stack can be troublesome, but it is effective to problem that require tracking depths or levels. + + +# Approach + +1. Maintain Element belonging to the same level in the stack. +2. While Iterating through the stack, remove the current level and save the next level. +- In GoLang, `range for loop` capture only first once. So We can maintain current level's easily. +3. increase depth while iterationg through all elements until the end. +# Complexity +- Time complexity: $$O(n)$$ + + +- Space complexity + - $$O(logN)$$ (best case for balanced tree) + - $$O(N)$$ (worst case for skewed tree) + +(N: size of node.) + +# Code +``` +func maxDepth(root *TreeNode) int { + if root == nil { + return 0 + } + depth := 0 + currLevel := []*TreeNode{root} + + for len(currLevel) != 0 { + depth++ + for _, curr := range currLevel { + if curr.Left != nil { + currLevel = append(currLevel, curr.Left) + } + if curr.Right != nil { + currLevel = append(currLevel, curr.Right) + } + currLevel = currLevel[1:] + } + } + + return depth +} +``` \ No newline at end of file From 3991530a6a23d2d765f431adec19471bd6c9857a Mon Sep 17 00:00:00 2001 From: Invidam Date: Wed, 15 May 2024 10:09:47 +0900 Subject: [PATCH 02/10] docs: change word --- maximum-depth-of-binary-tree/invidam.go.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/maximum-depth-of-binary-tree/invidam.go.md b/maximum-depth-of-binary-tree/invidam.go.md index 7cb6d4040..0f4c6eae6 100644 --- a/maximum-depth-of-binary-tree/invidam.go.md +++ b/maximum-depth-of-binary-tree/invidam.go.md @@ -26,13 +26,13 @@ func maxDepth(root *TreeNode) int { ``` - - - # Intuition -Implement Stack can be troublesome, but it is effective to problem that require tracking depths or levels. +Implement Queue can be troublesome, but it is effective to problem that require tracking depths or levels. # Approach -1. Maintain Element belonging to the same level in the stack. -2. While Iterating through the stack, remove the current level and save the next level. +1. Maintain Element belonging to the same level in the queue. +2. While Iterating through the queue, remove the current level and save the next level. - In GoLang, `range for loop` capture only first once. So We can maintain current level's easily. 3. increase depth while iterationg through all elements until the end. # Complexity From 2a7011caed713fd05884a21b1a28e87ae10e522b Mon Sep 17 00:00:00 2001 From: Invidam Date: Wed, 15 May 2024 15:45:41 +0900 Subject: [PATCH 03/10] feat: solve same-tree --- maximum-depth-of-binary-tree/invidam.go.md | 5 +- same-tree/invidam.go.md | 82 ++++++++++++++++++++++ 2 files changed, 86 insertions(+), 1 deletion(-) create mode 100644 same-tree/invidam.go.md diff --git a/maximum-depth-of-binary-tree/invidam.go.md b/maximum-depth-of-binary-tree/invidam.go.md index 0f4c6eae6..da4b044e4 100644 --- a/maximum-depth-of-binary-tree/invidam.go.md +++ b/maximum-depth-of-binary-tree/invidam.go.md @@ -69,4 +69,7 @@ func maxDepth(root *TreeNode) int { return depth } -``` \ No newline at end of file +``` + +# What I learned +- **Slice** \ No newline at end of file diff --git a/same-tree/invidam.go.md b/same-tree/invidam.go.md new file mode 100644 index 000000000..3ac815e9b --- /dev/null +++ b/same-tree/invidam.go.md @@ -0,0 +1,82 @@ +# Intuition (DFS, Recursion) + +Recursion is natural method to iterate trees. (Particularly, multiple trees!) +# Approach + +1. Child nodes(i.e. Left and Right) are compared eqaulity with their subtrees. +2. Parent nodes check their own values (`Val`) and their children's comparisions. + +(Tip: Comparing the values of nodes before recursion is more efficient. due to **short circuit**, which stops further evaluation(`isSameTree(p.Left, q.Left) && isSameTree(p.Right, q.Right)`) when the outcome is already determined by comparing `p.Val == q.Val`) +# Complexity +- Time complexity: $$O(n+m)$$ + + +- Space complexity: $$O(h_n + h_m)$$ + + +(n and m are number of nodes in trees p and q. $$h_n$$ and $$h_m$$ are their heights.) +# Code +``` +func isSameTree(p *TreeNode, q *TreeNode) bool { + if p == nil || q == nil { + return p == nil && q == nil + } + + return p.Val == q.Val && isSameTree(p.Left, q.Left) && isSameTree(p.Right, q.Right) +} +``` +- - - +# BFS +# Approach + +1. Like a typical BFS solution, Create Queue and iterate through the tree. However, in this case, mulitple queues are required. +2. While Iterating, Check equality two nodes in p and q. +# Complexity +- Time complexity: $$O(n+m)$$ + + +- Space complexity: $$O(n + m)$$ + + +(n and m are number of nodes in trees p and q.) +# Code +``` +func updateQueue(node *TreeNode, queue []*TreeNode) []*TreeNode { + queue = append(queue, node.Left) + queue = append(queue, node.Right) + + return queue +} + +func isSameTree(p *TreeNode, q *TreeNode) bool { + if p == nil || q == nil { + return p == nil && q == nil + } + pQueue := []*TreeNode{p} + qQueue := []*TreeNode{q} + + for len(pQueue) != 0 { + pCurr := pQueue[0] + qCurr := qQueue[0] + + pQueue = pQueue[1:] + qQueue = qQueue[1:] + + if pCurr == nil && qCurr == nil { + continue + } + + if (pCurr == nil || qCurr == nil) || (pCurr.Val != qCurr.Val) { + return false + } + pQueue = updateQueue(pCurr, pQueue) + qQueue = updateQueue(qCurr, qQueue) + } + + return true +} +``` + +# What I learned +- Short circuit In Go. +- Function couldn't update original value (like `updateQueue()'s queue`) \ No newline at end of file From d77b7bf88043dbc10915f9a7cc9130d301accd01 Mon Sep 17 00:00:00 2001 From: Invidam Date: Wed, 15 May 2024 15:46:14 +0900 Subject: [PATCH 04/10] =?UTF-8?q?docs:=20=EB=A7=81=ED=81=AC=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- maximum-depth-of-binary-tree/invidam.go.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/maximum-depth-of-binary-tree/invidam.go.md b/maximum-depth-of-binary-tree/invidam.go.md index da4b044e4..0fa4cafc0 100644 --- a/maximum-depth-of-binary-tree/invidam.go.md +++ b/maximum-depth-of-binary-tree/invidam.go.md @@ -72,4 +72,4 @@ func maxDepth(root *TreeNode) int { ``` # What I learned -- **Slice** \ No newline at end of file +- [Slice](https://velog.io/@invidam/GoLang-Slice) \ No newline at end of file From 73a0495a7bd77b088a84e808a071d5ffcd3ad4c0 Mon Sep 17 00:00:00 2001 From: Invidam Date: Thu, 16 May 2024 14:15:36 +0900 Subject: [PATCH 05/10] feat: subtree-of-another-tree --- subtree-of-another-tree/invidam.go.md | 105 ++++++++++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 subtree-of-another-tree/invidam.go.md diff --git a/subtree-of-another-tree/invidam.go.md b/subtree-of-another-tree/invidam.go.md new file mode 100644 index 000000000..c5faa3007 --- /dev/null +++ b/subtree-of-another-tree/invidam.go.md @@ -0,0 +1,105 @@ +# Intuition (DFS & BFS) + +We need two main function: one to check the equality of nodes and the subtrees, and another to iterate through the main tree. + +We will use both DFS and BFS methods to solve this problem. + +Reference. [Same Tree](ttps://leetcode.com/problems/same-tree/solutions/5159658/go-simple-solution) + +# Approach + +1. Create a function that, while iterating using DFS(Recursion) or BFS(Queue),checks if the two trees are equal. +2. First, check if the two trees are equal. If not, iterate through the children of main tree. (`root.Left`, `root.Right`) +# Complexity (DFS) +- Time complexity: $$O(n * m)$$ + (This complexity is $$O(n * m)$$. because the `isSubtree()` iterates throuth all modes while **simultaneously** calling the `isEqualtree()` for each node. + + +- Space complexity: $$O({h_n} + {h_m})$$ + (This complexity is determined. because the maximun depth of the call stack, which doesn't exceed the sum of heights of both trees.) + + +# Code +``` +func isEqualTree(root *TreeNode, subRoot *TreeNode) bool { + if (root == nil) || (subRoot == nil) { + return root == subRoot + } + + return (root.Val == subRoot.Val) && isEqualTree(root.Left, subRoot.Left) && isEqualTree(root.Right, subRoot.Right) +} + +func isSubtree(root *TreeNode, subRoot *TreeNode) bool { + if root == nil { + //assert subRoot != nil + return false + } + + return isEqualTree(root, subRoot) || isSubtree(root.Left, subRoot) || isSubtree(root.Right, subRoot) +} +``` +- - - +# Complexity (BFS) +- Time complexity: $$O(n * m)$$ + (This complexity is $$O(n * m)$$. because the `isSubtree()` iterates throuth all modes while **simultaneously** calling the `isEqualtree()` for each node. + + +- Space complexity: $$O({h_n} + {h_m})$$ + (This complexity is determined. because the maximun sizes of the queues (`q`, `q1`, `q2`), which doesn't exceed the sum of sizes of both trees.) + +# Code +``` +func isEqualTree(root *TreeNode, subRoot *TreeNode) bool { + q1 := []*TreeNode{root} + q2 := []*TreeNode{subRoot} + + for len(q1) != 0 { + f1 := q1[0] + f2 := q2[0] + + q1 = q1[1:] + q2 = q2[1:] + + if (f1 == nil) && (f2 == nil) { + continue + } + if (f1 == nil) || (f2 == nil) || (f1.Val != f2.Val) { + return false + } + + q1 = append(q1, f1.Left) + q1 = append(q1, f1.Right) + + q2 = append(q2, f2.Left) + q2 = append(q2, f2.Right) + } + + return true +} + +func isSubtree(root *TreeNode, subRoot *TreeNode) bool { + if root == nil { + //assert subRoot != nil + return false + } + + q := []*TreeNode{root} + + for len(q) != 0 { + node := q[0] + q = q[1:] + + if node == nil { + continue + } + if isEqualTree(node, subRoot) { + return true + } + + q = append(q, node.Left) + q = append(q, node.Right) + } + + return false +} +``` \ No newline at end of file From 5d244b9cd5dfaeb767e75ed40bdfca1d7c585b31 Mon Sep 17 00:00:00 2001 From: Invidam Date: Fri, 17 May 2024 08:05:49 +0900 Subject: [PATCH 06/10] =?UTF-8?q?feat:=20climb-stairs=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- climbing-stairs/invidam.go.md | 83 +++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 climbing-stairs/invidam.go.md diff --git a/climbing-stairs/invidam.go.md b/climbing-stairs/invidam.go.md new file mode 100644 index 000000000..bf31e559d --- /dev/null +++ b/climbing-stairs/invidam.go.md @@ -0,0 +1,83 @@ +# Intuition + +This problem is a typical dynamic programming (DP) problem. (keyword: `Fibonacci`) + +DP has two methods: tabulation and memoization. I'll introduce both methods. +# Approach (tabulation) + +1. Create an array to store the results. +2. Initiate default values for the base cases `0` and `1`. +3. While iterating through the array, fill in the values using this formula $$f(n) = f(n-1) + f(n-2)$$ +# Complexity +## Complexity (V1) +- Time complexity: $$O(n)$$ + + +- Space complexity: $$O(n)$$ + +# Complexity (V2) +- Time complexity: $$O(n)$$ + + +- Space complexity: $$O(1)$$ + + +(n is value of `n`) +# Code +``` +func climbStairsV1(n int) int { + climbData := make([]int, n+2, n+2) + climbData[0], climbData[1] = 1, 1 + for s := 0; s < n; s++ { + climbData[s+2] = climbData[s] + climbData[s+1] + } + + return climbData[n] +} + +func climbStairsV2(n int) int { + prev, curr := 1, 1 + for s := 1; s < n; s++ { + prev, curr = curr, prev + curr + } + + return curr +} +``` + +> As you can see in `V2`, it can be optimized. Remove the array and maintain only the `prev` and `curr` values. In Golang, `Multiple Assignment` prodives syntatic sugar. + +- - - + +# Approach (memoization) + +1. Create an hash map (or array) to **cache** the results. +2. Initialize default values to indicate unvisited nodes. (`-1`). +3. Call the recursion using this formula $$f(n) = f(n-1) + f(n-2)$$. +4. If there are cached results, return it. +5. Pay attension to the **base case**, and always update the cache. + +# Complexity +- Time complexity: $$O(n)$$ + + +- Space complexity: $$O(n)$$ + +(n is value of `n`) +# Code +``` +var cache map[int]int = map[int]int{} +func climbStairs(n int) int { + if n == 0 || n == 1 { + return 1 + } else if n < 0 { + return 0 + } else if val, ok := cache[n]; ok { + return val + } + + ret := climbStairs(n-1) + climbStairs(n-2) + cache[n] = ret + return ret +} +``` \ No newline at end of file From 557a0f9eeb94d67a4940eca1defe69b150fce3e0 Mon Sep 17 00:00:00 2001 From: Invidam Date: Sat, 18 May 2024 22:13:16 +0900 Subject: [PATCH 07/10] feat: meeting-rooms --- meeting-rooms/invidam.go.md | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 meeting-rooms/invidam.go.md diff --git a/meeting-rooms/invidam.go.md b/meeting-rooms/invidam.go.md new file mode 100644 index 000000000..b7d0dfa66 --- /dev/null +++ b/meeting-rooms/invidam.go.md @@ -0,0 +1,29 @@ +# Intuition +It is a simple `greedy` problem. +간단한 그리디 분류의 문제다. +# Approach +1. To find earliest interval, sort intervals by start time in ascending order. +2. After sorting, while iterating through the array, check for conflict: the current interval's start time shoud be smaller than the next interval's end time. +# Complexity +- Time complexity: $$O(nlog(n))$$ +- Space complexity: $$O(n)$$ + +(n is length of `intervals`) +# Code +```go +func CanAttendMeetings(intervals []*Interval) bool { + sort.Slice(intervals, func(i, j int) bool { + return intervals[i].Start < intervals[j].Start + }) + + curr := &Interval{-1, -1} + for _, next := range intervals { + if curr.End > next.Start { + return false + } + curr = next + } + + return true +} +``` \ No newline at end of file From 377bd1d86a4f5411b09723de030be4b4e4528d39 Mon Sep 17 00:00:00 2001 From: Invidam Date: Sat, 18 May 2024 22:17:59 +0900 Subject: [PATCH 08/10] =?UTF-8?q?docs:=20til=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- meeting-rooms/invidam.go.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/meeting-rooms/invidam.go.md b/meeting-rooms/invidam.go.md index b7d0dfa66..10d3aa2dc 100644 --- a/meeting-rooms/invidam.go.md +++ b/meeting-rooms/invidam.go.md @@ -26,4 +26,9 @@ func CanAttendMeetings(intervals []*Interval) bool { return true } -``` \ No newline at end of file +``` + +# What I learned +GoLang Sort +- mechanism: [Pattern-defeating Quicksort](https://www.youtube.com/watch?v=jz-PBiWwNjc) +- usage: https://hackthedeveloper.com/how-to-sort-in-go/ \ No newline at end of file From 2120a8b5a4753f5150f5d6817069e05fb39a9edf Mon Sep 17 00:00:00 2001 From: Invidam Date: Sun, 19 May 2024 13:59:33 +0900 Subject: [PATCH 09/10] =?UTF-8?q?style:=20code=20block=20`syntax`=20?= =?UTF-8?q?=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- climbing-stairs/invidam.go.md | 26 ++++---- maximum-depth-of-binary-tree/invidam.go.md | 38 +++++------ same-tree/invidam.go.md | 12 ++-- subtree-of-another-tree/invidam.go.md | 78 +++++++++++----------- 4 files changed, 77 insertions(+), 77 deletions(-) diff --git a/climbing-stairs/invidam.go.md b/climbing-stairs/invidam.go.md index bf31e559d..f5a1ad09f 100644 --- a/climbing-stairs/invidam.go.md +++ b/climbing-stairs/invidam.go.md @@ -24,24 +24,24 @@ DP has two methods: tabulation and memoization. I'll introduce both methods. (n is value of `n`) # Code -``` +```go func climbStairsV1(n int) int { - climbData := make([]int, n+2, n+2) - climbData[0], climbData[1] = 1, 1 - for s := 0; s < n; s++ { - climbData[s+2] = climbData[s] + climbData[s+1] - } + climbData := make([]int, n+2, n+2) + climbData[0], climbData[1] = 1, 1 + for s := 0; s < n; s++ { + climbData[s+2] = climbData[s] + climbData[s+1] + } - return climbData[n] + return climbData[n] } func climbStairsV2(n int) int { - prev, curr := 1, 1 - for s := 1; s < n; s++ { - prev, curr = curr, prev + curr - } + prev, curr := 1, 1 + for s := 1; s < n; s++ { + prev, curr = curr, prev+curr + } - return curr + return curr } ``` @@ -65,7 +65,7 @@ func climbStairsV2(n int) int { (n is value of `n`) # Code -``` +```go var cache map[int]int = map[int]int{} func climbStairs(n int) int { if n == 0 || n == 1 { diff --git a/maximum-depth-of-binary-tree/invidam.go.md b/maximum-depth-of-binary-tree/invidam.go.md index 0fa4cafc0..d1522a23b 100644 --- a/maximum-depth-of-binary-tree/invidam.go.md +++ b/maximum-depth-of-binary-tree/invidam.go.md @@ -48,26 +48,26 @@ Implement Queue can be troublesome, but it is effective to problem that require # Code ``` func maxDepth(root *TreeNode) int { - if root == nil { - return 0 - } - depth := 0 - currLevel := []*TreeNode{root} - - for len(currLevel) != 0 { - depth++ - for _, curr := range currLevel { - if curr.Left != nil { - currLevel = append(currLevel, curr.Left) - } - if curr.Right != nil { - currLevel = append(currLevel, curr.Right) - } - currLevel = currLevel[1:] - } - } + if root == nil { + return 0 + } + depth := 0 + currLevel := []*TreeNode{root} + + for len(currLevel) != 0 { + depth++ + for _, curr := range currLevel { + if curr.Left != nil { + currLevel = append(currLevel, curr.Left) + } + if curr.Right != nil { + currLevel = append(currLevel, curr.Right) + } + currLevel = currLevel[1:] + } + } - return depth + return depth } ``` diff --git a/same-tree/invidam.go.md b/same-tree/invidam.go.md index 3ac815e9b..6a638074f 100644 --- a/same-tree/invidam.go.md +++ b/same-tree/invidam.go.md @@ -16,13 +16,13 @@ Recursion is natural method to iterate trees. (Particularly, multiple trees!) (n and m are number of nodes in trees p and q. $$h_n$$ and $$h_m$$ are their heights.) # Code -``` +```go func isSameTree(p *TreeNode, q *TreeNode) bool { - if p == nil || q == nil { - return p == nil && q == nil - } + if p == nil || q == nil { + return p == nil && q == nil + } - return p.Val == q.Val && isSameTree(p.Left, q.Left) && isSameTree(p.Right, q.Right) + return p.Val == q.Val && isSameTree(p.Left, q.Left) && isSameTree(p.Right, q.Right) } ``` - - - @@ -40,7 +40,7 @@ func isSameTree(p *TreeNode, q *TreeNode) bool { (n and m are number of nodes in trees p and q.) # Code -``` +```go func updateQueue(node *TreeNode, queue []*TreeNode) []*TreeNode { queue = append(queue, node.Left) queue = append(queue, node.Right) diff --git a/subtree-of-another-tree/invidam.go.md b/subtree-of-another-tree/invidam.go.md index c5faa3007..9042c399e 100644 --- a/subtree-of-another-tree/invidam.go.md +++ b/subtree-of-another-tree/invidam.go.md @@ -48,58 +48,58 @@ func isSubtree(root *TreeNode, subRoot *TreeNode) bool { (This complexity is determined. because the maximun sizes of the queues (`q`, `q1`, `q2`), which doesn't exceed the sum of sizes of both trees.) # Code -``` +```go func isEqualTree(root *TreeNode, subRoot *TreeNode) bool { - q1 := []*TreeNode{root} - q2 := []*TreeNode{subRoot} + q1 := []*TreeNode{root} + q2 := []*TreeNode{subRoot} - for len(q1) != 0 { - f1 := q1[0] - f2 := q2[0] + for len(q1) != 0 { + f1 := q1[0] + f2 := q2[0] - q1 = q1[1:] - q2 = q2[1:] + q1 = q1[1:] + q2 = q2[1:] - if (f1 == nil) && (f2 == nil) { - continue - } - if (f1 == nil) || (f2 == nil) || (f1.Val != f2.Val) { - return false - } + if (f1 == nil) && (f2 == nil) { + continue + } + if (f1 == nil) || (f2 == nil) || (f1.Val != f2.Val) { + return false + } - q1 = append(q1, f1.Left) - q1 = append(q1, f1.Right) + q1 = append(q1, f1.Left) + q1 = append(q1, f1.Right) - q2 = append(q2, f2.Left) - q2 = append(q2, f2.Right) - } - - return true + q2 = append(q2, f2.Left) + q2 = append(q2, f2.Right) + } + + return true } func isSubtree(root *TreeNode, subRoot *TreeNode) bool { - if root == nil { - //assert subRoot != nil - return false - } + if root == nil { + //assert subRoot != nil + return false + } - q := []*TreeNode{root} + q := []*TreeNode{root} - for len(q) != 0 { - node := q[0] - q = q[1:] + for len(q) != 0 { + node := q[0] + q = q[1:] - if node == nil { - continue - } - if isEqualTree(node, subRoot) { - return true - } + if node == nil { + continue + } + if isEqualTree(node, subRoot) { + return true + } - q = append(q, node.Left) - q = append(q, node.Right) - } + q = append(q, node.Left) + q = append(q, node.Right) + } - return false + return false } ``` \ No newline at end of file From 7ae7990fd257c4d05c281dec3bff6dc4e449e8ef Mon Sep 17 00:00:00 2001 From: Invidam Date: Sun, 19 May 2024 14:04:51 +0900 Subject: [PATCH 10/10] =?UTF-8?q?style:=20code=20block=20`syntax`=20?= =?UTF-8?q?=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- maximum-depth-of-binary-tree/invidam.go.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/maximum-depth-of-binary-tree/invidam.go.md b/maximum-depth-of-binary-tree/invidam.go.md index d1522a23b..2b2d4355d 100644 --- a/maximum-depth-of-binary-tree/invidam.go.md +++ b/maximum-depth-of-binary-tree/invidam.go.md @@ -46,7 +46,7 @@ Implement Queue can be troublesome, but it is effective to problem that require (N: size of node.) # Code -``` +```go func maxDepth(root *TreeNode) int { if root == nil { return 0