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
package main | |
import ( | |
"encoding/csv" | |
"fmt" | |
"log" | |
"os" | |
"regexp" | |
"sort" | |
"strconv" |
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 Node: | |
def __init__(self, val, left, right): | |
self.val = val | |
self.left = left | |
self.right = right | |
t = Node(3, | |
Node(2, | |
Node(1,None,None), |
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
# Generate all the primes (and quite a few non-primes, but meh) | |
def primeish(): | |
for n in 2,3,5: | |
yield n | |
base = 6 | |
while True: | |
yield base+1 | |
yield base+5 | |
base = base+6 |
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
""" | |
"" Solution: Runs (Google Code Jam 2011 World Finals Problem A) | |
"" by: aq@okaq.com | |
"" run: python A.py infile outfile | |
""" | |
import sys | |
import time | |
import collections |