Skip to content

Instantly share code, notes, and snippets.

View gcapell's full-sized avatar

Gary Capell gcapell

  • Sydney, Australia
View GitHub Profile
package main
import (
"encoding/csv"
"fmt"
"log"
"os"
"regexp"
"sort"
"strconv"
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),
@gcapell
gcapell / power.py
Created February 12, 2019 07:19
Given n, find a,b such that a**b = n
# 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
@gcapell
gcapell / A.py
Created August 10, 2011 04:23 — forked from okaq/A.py
Solution: Runs (Google Code Jam 2011 World Finals Problem A)
"""
"" 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