Skip to content

Instantly share code, notes, and snippets.

def can_map(numbers, letters):
# print "in can_map for {} and {}".format(numbers, letters)
if (
len(numbers) > len(letters) or
numbers.count('0') > letters.count('A') or
('B' in letters and '0' not in numbers)
):
return False
if len(numbers) == 1:
from unittest import TestCase, main
def bin_s(search_space, thing):
low = 0
high = len(search_space) - 1
while low + 1 < high:
# this is python 2, so will round down
mid = (high - low) / 2 + low
@saoili
saoili / APileOfBricks.py
Created May 15, 2017 21:37
attempt at a pile of bricks
import sys
def split_vert(vert):
""" strips surrounding brackets, splits on comma, casts to int
"""
return [int(c) for c in vert[1:-1].split(',')]
class Hole(object):