Skip to content

Commit

Permalink
feat: 94. Binary Tree Inorder Traversal (#80)
Browse files Browse the repository at this point in the history
Signed-off-by: ashing <[email protected]>
  • Loading branch information
ronething committed Feb 10, 2024
1 parent b930181 commit 06ab053
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 30 deletions.
29 changes: 2 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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

Expand Down
6 changes: 3 additions & 3 deletions guns/struct.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package guns

//TreeNode 树节点
// TreeNode 树节点
type TreeNode struct {
Val int
Left *TreeNode
Expand All @@ -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
Expand Down
20 changes: 20 additions & 0 deletions leetcode_daily/20240210/94. Binary Tree Inorder Traversal.go
Original file line number Diff line number Diff line change
@@ -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
}

0 comments on commit 06ab053

Please sign in to comment.