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
/* | |
* docs | |
* Webtask - https://webtask.io | |
* Twitter - https://dev.twitter.com/oauth/application-only | |
* note | |
* Here is an easy way to base64 your consumer key and consumer secret | |
* from the command line: | |
* | |
* echo -n "CONSUMER_KEY:CONSUMER_SECRET" | base64 | |
* |
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
const trivialCase = [ 5, -6, 7, 12, -3, 0, -11, -6 ]; | |
function sumValues(a, b) { | |
return a + b | |
} | |
function sumSubArraysStartingAtValue(arr, i) { | |
let sums = [] | |
for(let j = i+1; j < arr.length; j++ ) { |
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
function getPermutations(string, p) { | |
if(string.length <= 1) return new Set(string) | |
let allCharsExceptLast = string.slice(0, -1) | |
let lastChar = string[string.length - 1] | |
let permutationsOfAllCharsExceptLast = getPermutations(allCharsExceptLast); | |
let permutations = new Set() | |
for(let perm of permutationsOfAllCharsExceptLast) { |
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
# Trend: holds a subset of nodes m from a larger series y where | |
# the relationship between node m0 ... mlen(m-1) is one of positive growth, negative growth, | |
# or plateaued growth as evalulated from left to right | |
class Trend: | |
def __init__(self, node): | |
self.direction = "trend setter" | |
self.nodes = list() | |
self.length = 1 | |
self.nodes.append(node) | |
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
class AgencyList: | |
def __init__(self): | |
self.verticies = list() | |
self.edges = dict() | |
# dict of lists | |
def initEdge(self, v1, v2): | |
if not v1 in self.edges: | |
self.edges[v1] = list() | |
if not v2 in self.edges: | |
self.edges[v2] = list() |
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
// input processing | |
function createMatrix(rows) { | |
// regex to filter only digits | |
let re = /[0-9]/ | |
let matrix = [] | |
for ( let row of rows ) { | |
matrix.push( row.split(' ') | |
.filter( i => re.test(i) === true) | |
.map( i => parseInt(i) ) | |
.sort( (a,b) => a - b ) ); |
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
import tweepy | |
import json | |
CONSUMER_KEY = # your consumer key | |
CONSUMER_SECRET = # your consumer secret | |
ACCESS_KEY = # your access key | |
ACCESS_SECRET = # your access secret | |
auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET) | |
auth.set_access_token(ACCESS_KEY, ACCESS_SECRET) |
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
# MergeSort Recursive Solution | |
# Python | |
def Merge(left, right, original): | |
left_len = len(left) | |
right_len = len(right) | |
left_index = 0 | |
right_index = 0 | |
original_index = 0 | |