Add stock
All checks were successful
ci/woodpecker/push/test Pipeline was successful

This commit is contained in:
2023-02-09 21:34:48 +08:00
parent b8d1550a43
commit 331178cb2c
5 changed files with 62 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
#include "s0122_best_time_to_buy_and_sell_stock_ii.hpp"
#include <gtest/gtest.h>
TEST(Problem122, Case1) {
vector<int> prices{7, 1, 5, 3, 6, 4};
int expected{7};
S0122 solution;
EXPECT_EQ(solution.maxProfit(prices), expected);
}
TEST(Problem122, Case2) {
vector<int> prices{7, 6, 4, 3, 1};
int expected{0};
S0122 solution;
EXPECT_EQ(solution.maxProfit(prices), expected);
}