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
-- 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} | |