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

Added June 1 code #6

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
5 changes: 5 additions & 0 deletions JuneChallenge/Delete Node in a Linked List.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

class Solution:
def deleteNode(self, node):
node.val = node.next.val
node.next = node.next.next
21 changes: 21 additions & 0 deletions JuneChallenge/InvertBinaryTree.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right


class Solution:
def invert(self, root: TreeNode):
if(root == None):
return
else:
root.left, root.right = root.right, root.left
self.invert(root.right)
self.invert(root.left)
return root

def invertTree(self, root: TreeNode) -> TreeNode:
a = self.invert(root)
return a