Solved MaxSliceSum in java