Skip to content

Instantly share code, notes, and snippets.

View jianchenglee's full-sized avatar

jianchenglee jianchenglee

View GitHub Profile
@jianchenglee
jianchenglee / gist:7262518
Last active December 27, 2015 03:49
water pool amount
-- author ljc
-- 1) find the max value, split the array to 2 array
-- 2) compute the increment ,get 2 increment array
-- 3) get the result by the increment value(if there are a minus value,then retain water,until one by one accumulation value become plus,then go on next)
waterpool={2,4,3,5,1,2,3,2,3,7,7,6,7,6,4,5}
testcase_1 = {2,5,1,2,3,4,7,7,6}
testcase_2 = {2,5,1,3,1,2,1,7,7,6}
testcase_3 = {6,1,4,6,7,5,1,6,4}