Skip to content

Instantly share code, notes, and snippets.

View priyankvex's full-sized avatar
💭
Chilling 🍺

Priyank Verma priyankvex

💭
Chilling 🍺
View GitHub Profile
@priyankvex
priyankvex / maximum_path_sum.py
Created May 4, 2019 08:49
Find maximum path sum in a binary tree
"""
https://scammingthecodinginterview.com
Week 2: Trees
Problem: 5
"""
class TreeNode(object):
def __init__(self, x):
self.val = x
@priyankvex
priyankvex / diameter_of_binary_tree.py
Created May 2, 2019 19:00
Find the diameter of a binary tree
"""
https://scammingthecodinginterview.com
Week 2: Trees
Problem: 4
"""
class Node:
def __init__(self, data):
@priyankvex
priyankvex / is_binary_tree_a_bst.py
Created May 1, 2019 17:15
Check whether a binary tree is a binary search tree or not.
"""
https://scammingthecodinginterview.com
Week 2: Trees
Problem: 3
"""
class Node:
def __init__(self, value):
self.left = None
@priyankvex
priyankvex / binary_tree_to_doubly_linked_list.py
Created April 30, 2019 17:12
In place, convert a binary tree into double linked list
"""
https://scammingthecodinginterview.com
Week 2: Trees
Problem: 2
"""
class Node(object):
def __init__(self, value):
self.value = value
@priyankvex
priyankvex / find_duplicate_number.py
Created February 28, 2019 15:20
find duplicate number : Scamming the coding interview 051
"""
Scamming the coding interview. Problem 051
Subscribe to our newsletter at https://scammingthecodinginterview.com/
to get a coding or design problem daily in your inbox and become exceptionally good at
coding interviews.
"""
class Solution(object):
@priyankvex
priyankvex / find_duplicate_number.py
Created February 28, 2019 15:20
find duplicate number : Scamming the coding interview 051
"""
Scamming the coding interview. Problem 051
Subscribe to our newsletter at https://scammingthecodinginterview.com/
to get a coding or design problem daily in your inbox and become exceptionally good at
coding interviews.
"""
class Solution(object):
@priyankvex
priyankvex / max_i_j.py
Created February 25, 2019 18:53
Problem 050 : Scamming the coding interview
"""
Scamming the coding interview. Problem 050
Subscribe to our newsletter at https://scammingthecodinginterview.com/
to get a coding or design problem daily in your inbox and become exceptionally good at
coding interviews.
"""
class Solution(object):
@priyankvex
priyankvex / distinct_occurrences_as_subsequence.py
Created February 22, 2019 15:29
Scammingthecodinginterview.com: Problem 049 : Distinct occurrences as subsequence
"""
Scamming the coding interview. Problem 049
Subscribe to our newsletter at https://scammingthecodinginterview.com/
to get a coding or design problem daily in your inbox and become exceptionally good at
coding interviews.
"""
class Solution(object):
@priyankvex
priyankvex / painters_partition.py
Created February 19, 2019 20:18
Scamming the coding interview: Problem 048: Painter's partition
"""
Scamming the coding interview. Problem 048
Subscribe to our newsletter at https://scammingthecodinginterview.com/
to get a coding or design problem daily in your inbox and become exceptionally good at
coding interviews.
"""
class Solution(object):
@priyankvex
priyankvex / edit_distance.py
Created February 18, 2019 19:56
Scammingthecodinginterview.com: Problem 046: Edit distance
"""
Scamming the coding interview. Problem 047
Subscribe to our newsletter at https://scammingthecodinginterview.com/
to get a coding or design problem daily in your inbox and become exceptionally good at
coding interviews.
"""
class Solution(object):