This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
DELETE node from Binary Tree | |
CORE CASES: | |
*** CAREFUL/INTERESTING | |
-- need to distinguish applicable SIDE(left or right child); INTO TARGET from | |
PARENT, as well as OUT of TARGET | |
- target is root => reset root to None | |
- target has no child; and target is LEFT or RIGHT child of parent | |
=> reset parent's child (specific side) to None |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 2D Matrix Ops | |
import sys | |
from functools import partial | |
# SLICING | |
""" | |
=> operates on SHALLOW REFERENCE PTR to COMPLEX types (like list, array); | |
OR actual VALUES of PRIMITIVE types (like char, int) | |
- https://www.python-course.eu/deep_copy.php | |
a[start:end] # items start through end-1 (ie NOT inclusive of END) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# calculate 1D stats on data | |
data = [10, 2, 38, 23, 21, 5, 38, 23] | |
# sum | |
dataSum = sum (data) | |
print ('sum is: {}'.format(dataSum)) | |
# COUNT | |
count = len (data) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
PROBLEM: | |
4-digit number: 2284 | |
- assume have dictionary isWord(String word) | |
- assume have phonenum pad digit to set of letters | |
- print all possible words of ANY length up to 4-digits | |
eg 2->A,B,C |
OlderNewer