-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathBestTimeToBuyAndSellStockIIITest.php
59 lines (53 loc) · 1.45 KB
/
BestTimeToBuyAndSellStockIIITest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
declare(strict_types=1);
namespace leetcode\tests;
use leetcode\BestTimeToBuyAndSellStockIII;
use PHPUnit\Framework\TestCase;
class BestTimeToBuyAndSellStockIIITest extends TestCase
{
public function testMaxProfit(): void
{
self::assertSame(
6,
BestTimeToBuyAndSellStockIII::maxProfit([3, 3, 5, 0, 0, 3, 1, 4])
);
self::assertSame(
4,
BestTimeToBuyAndSellStockIII::maxProfit([1, 2, 3, 4, 5])
);
self::assertSame(
0,
BestTimeToBuyAndSellStockIII::maxProfit([7, 6, 4, 3, 1])
);
}
public function testMaxProfit2(): void
{
self::assertSame(
6,
BestTimeToBuyAndSellStockIII::maxProfit2([3, 3, 5, 0, 0, 3, 1, 4])
);
self::assertSame(
4,
BestTimeToBuyAndSellStockIII::maxProfit2([1, 2, 3, 4, 5])
);
self::assertSame(
0,
BestTimeToBuyAndSellStockIII::maxProfit2([7, 6, 4, 3, 1])
);
}
public function testMaxProfit3(): void
{
self::assertSame(
6,
BestTimeToBuyAndSellStockIII::maxProfit3([3, 3, 5, 0, 0, 3, 1, 4])
);
self::assertSame(
4,
BestTimeToBuyAndSellStockIII::maxProfit3([1, 2, 3, 4, 5])
);
self::assertSame(
0,
BestTimeToBuyAndSellStockIII::maxProfit3([7, 6, 4, 3, 1])
);
}
}