twitter interview problem, using dynamicprogramming, java version
twitter watersink python version