Exemple #1
0
        public void Test2()
        {
            var bs          = new StockBuySellToMaxProfit();
            int totalProfit = bs.BuyAndSell(new int[] { 4, 3, 2 });

            Assert.That(totalProfit, Is.EqualTo(0));
        }
Exemple #2
0
        public void Test3()
        {
            var bs          = new StockBuySellToMaxProfit();
            int totalProfit = bs.BuyAndSell(new int[] { 1, 1, 1000, 1, 1, 100000 });

            Assert.That(totalProfit, Is.EqualTo(100998));
        }
Exemple #3
0
        public void Test1()
        {
            var bs          = new StockBuySellToMaxProfit();
            int totalProfit = bs.BuyAndSell(new int[] { 100, 180, 260, 310, 40, 535, 695 });

            Assert.That(totalProfit, Is.EqualTo(865));
        }