This file contains 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
def find_anagrams(words): | |
""" | |
Find anagrams in O(n*m) time and O(n) space. | |
Notes: returns all words in input that are anagrams of another word. | |
""" | |
anagrams = [] | |
sorted_words = {} | |
for word in words: # O(n) |
This file contains 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
def get_products_of_all_ints_except_at_index(int_array): | |
""" | |
Single pass. | |
""" | |
# Condition where element has neither left nor right elements | |
if len(int_array) == 1: | |
# Maybe [None] ? | |
return [0] |
This file contains 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
#!/usr/bin/env bash | |
### Repl Usage: | |
# | |
# $ ./phantomjs-repl.sh | |
# > missing | |
# ReferenceError: Can't find variable: missing | |
# > window | |
# [object Window] | |
# > console.log('Hello') |
NewerOlder