File tree 2 files changed +18
-1
lines changed
2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change 64
64
| 217 | [ Contains Duplicate] ( https://leetcode.com/problems/contains-duplicate ) | Easy | [ ![ Java] ( https://img.icons8.com/color/40/000000/java-coffee-cup-logo.png )] ( src/ContainsDuplicate.java ) [ ![ Python] ( https://img.icons8.com/color/35/000000/python.png )] ( python/contains_duplicate.py ) |
65
65
| 219 | [ Contains Duplicate II] ( https://leetcode.com/problems/contains-duplicate-ii ) | Easy | [ ![ Java] ( https://img.icons8.com/color/40/000000/java-coffee-cup-logo.png )] ( src/ContainsDuplicateII.java ) [ ![ Python] ( https://img.icons8.com/color/35/000000/python.png )] ( python/contains_duplicate_ii.py ) |
66
66
| 225 | [ Implement Stack using Queues] ( https://leetcode.com/problems/implement-stack-using-queues ) | Easy | [ ![ Java] ( https://img.icons8.com/color/40/000000/java-coffee-cup-logo.png )] ( src/MyStack.java ) [ ![ Python] ( https://img.icons8.com/color/35/000000/python.png )] ( python/implement_stack_using_queues.py ) |
67
- | 226 | [ Invert Binary Tree] ( https://leetcode.com/problems/invert-binary-tree ) | Easy | [ ![ Java] ( https://img.icons8.com/color/40/000000/java-coffee-cup-logo.png )] ( src/InvertBinaryTree.java ) |
67
+ | 226 | [ Invert Binary Tree] ( https://leetcode.com/problems/invert-binary-tree ) | Easy | [ ![ Java] ( https://img.icons8.com/color/40/000000/java-coffee-cup-logo.png )] ( src/InvertBinaryTree.java ) [ ![ Python ] ( https://img.icons8.com/color/35/000000/python.png )] ( python/invert_binary_tree.py ) |
68
68
| 231 | [ Power of Two] ( https://leetcode.com/problems/power-of-two ) | Easy | [ ![ Java] ( https://img.icons8.com/color/40/000000/java-coffee-cup-logo.png )] ( src/PowerOf2.java ) |
69
69
| 232 | [ Implement Queue Using Stacks] ( ) | Easy | [ ![ Java] ( https://img.icons8.com/color/40/000000/java-coffee-cup-logo.png )] ( src/MyQueue.java ) |
70
70
| 234 | [ Palindrome Linked Lists] ( https://leetcode.com/problems/palindrome-linked-list ) | Easy | [ ![ Java] ( https://img.icons8.com/color/40/000000/java-coffee-cup-logo.png )] ( src/PalindromeLinkedList.java ) |
Original file line number Diff line number Diff line change
1
+ # Definition for a binary tree node.
2
+ from typing import Optional
3
+
4
+
5
+ class TreeNode :
6
+ def __init__ (self , val = 0 , left = None , right = None ):
7
+ self .val = val
8
+ self .left = left
9
+ self .right = right
10
+
11
+
12
+ class Solution :
13
+ def invertTree (self , root : TreeNode ) -> Optional [TreeNode ]:
14
+ if root is None :
15
+ return None
16
+ root .left , root .right = self .invertTree (root .right ), self .invertTree (root .left )
17
+ return root
You can’t perform that action at this time.
0 commit comments