일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- 잡생각
- Writing
- 괜찮음
- 화상영어
- 영어원서읽기
- leetcode
- 월간
- 사이드
- 매일
- 30분
- 리얼 클래스
- 쓰릴오브파이트
- realclass
- 프로젝트
- 영어공부
- 링피트
- 만화도
- 운동
- English
- Daily Challenge
- FIT XR
- 파비최
- 3줄정리
- 뭐든
- 스탭퍼
- 미드시청
- 개발자
- Problem Solving
- 읽기
- 10분
Archives
- Today
- Total
파비의 매일매일 공부기록
2023.12.09 Today's Challenge 본문
https://leetcode.com/problems/binary-tree-inorder-traversal/
Binary Tree Inorder Traversal - LeetCode
Can you solve this real interview question? Binary Tree Inorder Traversal - Given the root of a binary tree, return the inorder traversal of its nodes' values. Example 1: [https://assets.leetcode.com/uploads/2020/09/15/inorder_1.jpg] Input: root = [1,nu
leetcode.com
트리 순회 문제!
class Solution:
def inorderTraversal(self, root: Optional[TreeNode]) -> List[int]:
if not root:
return []
return self.inorderTraversal(root.left) + [root.val] + self.inorderTraversal(root.right)
반응형
'Problem Solving > LeetCode' 카테고리의 다른 글
2023.12.11 Today's Challenge (0) | 2023.12.11 |
---|---|
2023.12.10 Today's Challenge (0) | 2023.12.10 |
2023.12.08 Today's Challenge (0) | 2023.12.08 |
2023.12.07 Today's Challenge (0) | 2023.12.07 |
2023.12.06 Today's Challenge (0) | 2023.12.06 |
Comments