@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 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));
 }