Skip to content

Instantly share code, notes, and snippets.

@thulka
thulka / puddles.py
Last active December 28, 2015 02:39
Michael Kozakov blogged about a twitter interview question
# twitter interview question: http://qandwhat.apps.runkite.com/i-failed-a-twitter-interview/
#
# single pass
# recursive
#
# for debug and understanding, the function acc(umulate) returns the array of water levels in each bin.
def acc(land, i=0, leftmax=0):
leftmax = max(leftmax, land[i])
@thulka
thulka / jasmine.matcher.ts
Last active June 13, 2020 07:04
jasmine matcher in typescript - example. This one does the same as toEqual does on arrays.
module jasmine {
interface Matchers {
toHaveSameSequence(expected: any[]): boolean;
}
}
beforeEach(function () {
this.addMatchers(
{
toHaveSameSequence: function(expected: any[]) {