This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module jasmine { | |
interface Matchers { | |
toHaveSameSequence(expected: any[]): boolean; | |
} | |
} | |
beforeEach(function () { | |
this.addMatchers( | |
{ | |
toHaveSameSequence: function(expected: any[]) { |