Leetcode - 94. Binary Tree Inorder Traversal
此篇文章為我的解題紀錄,程式碼或許並不是很完善
Leetcode - 94. Binary Tree Inorder Traversal
解題思路
使用recursive來遍歷整個數樹,若是有左子樹就一直走,走到無左子樹後開始印出val
,再印出當前子樹的root的val
後接著再往右子樹走
我滴程式碼
1 | /** |
All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.
Comment
GitalkFacebook Comments