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
# | |
# You have data for social network on who is friends with whom. | |
# You need to write a function that returns this data in the form of an adjacency list representation, i.e. a mapping of each employee ID to a list of his/her friends on the site | |
# # | |
# You have two input data sets to work with. The first data set is the employees at your company, and the second is all the pairs of employees who are virtually friends so far. It does not matter which employee's ID is in which column, the friendships are bidirectional. | |
# | |
# employees_input = [ | |
# "1,Richard,Engineering", | |
# "2,Erlich,HR", | |
# "3,Monica,Business", |
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
""" | |
Given String "ABC", print all 3-letter permutations of this | |
""" | |
# SOLUTION: - FULL decision tree | |
# - each level is character place, | |
# each branch a choice of one char | |
# - REMAINING unchosen characters |
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 | |
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
# Build an N-Tree from 2D array of Parent-Child pairs | |
import logging | |
from collections import deque | |
""" | |
TREE: | |
3 | |
/ | \ | |
4 5 6 |
NewerOlder