Skip to content

Instantly share code, notes, and snippets.

View timdawborn's full-sized avatar

Tim Dawborn timdawborn

View GitHub Profile

Keybase proof

I hereby claim:

  • I am timdawborn on github.
  • I am timdawborn (https://keybase.io/timdawborn) on keybase.
  • I have a public key whose fingerprint is 9D45 557F 2E5B 4E0B 15BE 515F 1ABE E16D 4664 9CF6

To claim this, I am signing this object:

def A(d):
V=v=H=0
for h in d:V,v,H=h>H and(V+v,0,h)or(V,v+H-h,H)
return V
import turtle
L = 10
def draw_square():
turtle.pendown()
turtle.begin_fill()
for i in range(4):
turtle.forward(L)
#!/usr/bin/env python3
N = 2 * int(input('Enter N: '))
perm = count = 0
while perm < 2 ** N:
counts = [0, 0]
for i in range(N - 1, -1, -1):
counts[bool(perm & (1 << i))] += 1
if counts[1] - counts[0] < 0:
perm |= (2 ** i) - 1