Skip to content

Instantly share code, notes, and snippets.

View zeeshanlakhani's full-sized avatar

Zeeshan Lakhani zeeshanlakhani

View GitHub Profile
@zeeshanlakhani
zeeshanlakhani / disc.py
Created October 16, 2011 04:45 — forked from jaymzcd/disc.py
Codility tests
#!/usr/bin/env python2
from itertools import combinations
def number_of_disc_intersections(A):
boundries = list()
for x, r in enumerate(A):
boundries.append((x-r, x+r))
r = range(len(A))
@zeeshanlakhani
zeeshanlakhani / generator-ttd.scm
Created September 30, 2011 17:32 — forked from apg/generator-ttd.scm
generators (like python yield), in scheme, a language that doesn't normally have them.
;; Deriving something like generators, but I didn't really feel like
;; doing exactly that.
;; It doesn't, for instance, support sending back into the generator
;; This applys a function across a range from 0 to x.
(define (apply-to-range f i x)
(when (< i x)
(f i)
(apply-to-range f (+ 1 i) x)))