diff --git a/README.md b/README.md index 8d3a5d8..e2eeb9c 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,6 @@ **Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* - [algorithm-coding](#algorithm-coding) - - [directory](#directory) - [coding time](#coding-time) - [stats](#stats) - [acknowledgement](#acknowledgement) @@ -12,32 +11,8 @@ ## algorithm-coding -algorithm from beginner, include leetcode and other websites. - -### directory - -``` -. -├── LICENSE -├── README.md -├── acmmode // acm 模式输入输出练习 -├── acwing // acwing 相关 -├── guns // 工具包 -├── jianzhioffer // 剑指 offer -├── lcp // leetcode lcp -├── leetcode // 多年以前随便写的题 -├── leetcode_91_2 // 91 算法第二期 -├── leetcode_daily // 每日一题 -├── leetcode_hot100 // 热门题 -├── leetcode_interview // leetcode 面试题系列 -├── leetcode_mock // 模拟面试 -├── leetcode_week // 周赛 -├── nowcoder // 牛客网相关 -├── script // codecov 测试覆盖执行脚本 -└── topic // 代码随想录相关 -``` - - +The "algorithm-coding" GitHub repository offers a curated collection of coding problems and solutions to aid in interview preparation. +It covers essential topics for technical interviews, providing detailed explanations to improve problem-solving skills. ### coding time diff --git a/guns/struct.go b/guns/struct.go index 93c3a57..331d37d 100644 --- a/guns/struct.go +++ b/guns/struct.go @@ -1,6 +1,6 @@ package guns -//TreeNode 树节点 +// TreeNode 树节点 type TreeNode struct { Val int Left *TreeNode @@ -9,13 +9,13 @@ type TreeNode struct { //TODO: gen tree -//ListNode 链表节点 +// ListNode 链表节点 type ListNode struct { Val int Next *ListNode } -//GenLinkList +// GenLinkList 生成链表 func GenLinkList(nodes []int) *ListNode { p := &ListNode{} q := p diff --git a/leetcode_daily/20240210/94. Binary Tree Inorder Traversal.go b/leetcode_daily/20240210/94. Binary Tree Inorder Traversal.go new file mode 100644 index 0000000..0901821 --- /dev/null +++ b/leetcode_daily/20240210/94. Binary Tree Inorder Traversal.go @@ -0,0 +1,20 @@ +package _0240210 + +import "algorithm/guns" + +type TreeNode = guns.TreeNode + +func inorderTraversal(root *TreeNode) []int { + var res []int + var sub func(n *TreeNode) + sub = func(n *TreeNode) { + if n == nil { + return + } + sub(n.Left) + res = append(res, n.Val) + sub(n.Right) + } + sub(root) + return res +}