Skip to content

Instantly share code, notes, and snippets.

View DagnyTagg2013's full-sized avatar

TechiMomi DagnyTagg2013

View GitHub Profile
# 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)
# 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)
"""
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
@DagnyTagg2013
DagnyTagg2013 / buildNTreeFromParentChildPairs
Created November 6, 2017 06:30
Build N-Tree from List (Parent,Child)
# Build an N-Tree from 2D array of Parent-Child pairs
import logging
from collections import deque
"""
TREE:
3
/ | \
4 5 6