Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 94. Binary Tree Inorder Traversal #80

Merged
merged 1 commit into from
Feb 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
}
Loading