Skip to content

Instantly share code, notes, and snippets.

from collections import defaultdict
def key(x, y):
return "{0}-{1}".format(x, y)
def walk(grid, from_x, from_y, to_x, to_y):
grid[key(from_x, from_y)] += 1
while from_x != to_x or from_y != to_y:
if from_x < to_x:
from_x += 1
BINGO_SIZE = 5
class Bingo:
def __init__(self):
self.column_count = [0] * BINGO_SIZE
self.row_count = [0] * BINGO_SIZE
self.data = []
self.index = {}
self.called = set()
COUNT = 0
DATA = 1
class Trie:
def __init__(self):
self.root = Node()
def add_string(self, string):
node = self.root
for char in string:
node = node.add(char)
if __name__ == '__main__':
with open('input.txt') as data:
one_counts = []
total = 0
for line in data:
line = line.strip()
if len(one_counts) == 0:
one_counts = [0] * len(line)
for idx, char in enumerate(line):
if char == '1':
if __name__ == '__main__':
with open('input.txt') as data:
last = None
increased = 0
sum_window = 0
window = []
count = 0
for line in data:
value = int(line)
sum_window += value
04e56764616f40a379b3ca6f7d0ddc83fee6450a72164e53045b7e8159b33ebef90df5e52261c367a9a1820eb55d2e023fa5859d84daf7e524173f50dfee4debae;pablasso

Keybase proof

I hereby claim:

  • I am albertein on github.
  • I am albertein (https://keybase.io/albertein) on keybase.
  • I have a public key ASBQdWQFTBgaWxnJ2WYBtV3XuFO9pAozxjSvhF8K_34Szwo

To claim this, I am signing this object:

@albertein
albertein / scrolling.js
Created May 6, 2014 16:07
Scroll cycle.
var ids = [“tab1”, “tab2”, “tab3”….., “tabn”];
var tabIndex = 0;
window.setInterval(function() {
tabIndex = (tabIndex + 1) % ids.length;
var element = document.getElementById(ids[tabIndex]);
element.scrollIntoView(true);
}, 15 * 1000);
def merge(l1, l2)
out = []
while(!(l1.empty? && l2.empty?)) do
list = nil
if (l2.empty? || l1[0].timestamp < l2[0].timestamp)
list = l1
else
list = l2
end
element = list.slice!(0)
nodes = []
nodes.push(root)
while (!nodes.empty?) do
node = nodes.pop()
next if node.nil?
if (node.value < min)
node.parent.replace(node, node.right)
nodes.push(node.right)
elsif (node.value > max)
node.parent.replace(node, node.left)