public static void main(String[] args) {
   int[] prices = {30, 60, 30, 70, 80, 50};
   BestTimetoBuyandSellStockII solution = new BestTimetoBuyandSellStockII();
   System.out.println(solution.maxProfit(prices));
 }
 @Test
 public void test9() {
   int[] prices = {2, 2, 1};
   BestTimetoBuyandSellStockII a = new BestTimetoBuyandSellStockII();
   assertEquals(0, a.maxProfit(prices));
 }
 @Test
 public void test8() {
   int[] prices = {1, 1, 4};
   BestTimetoBuyandSellStockII a = new BestTimetoBuyandSellStockII();
   assertEquals(3, a.maxProfit(prices));
 }
 @Test
 public void test() {
   int[] prices = {3, 4, 5, 4, 1, 3, 6, 9, 8, 7};
   BestTimetoBuyandSellStockII a = new BestTimetoBuyandSellStockII();
   assertEquals(10, a.maxProfit(prices));
 }
 @Test
 public void test2() {
   BestTimetoBuyandSellStockII test = new BestTimetoBuyandSellStockII();
   assertEquals(1, test.maxProfit(new int[] {1, 2}));
 }