Template Function ADS::maxProfitExactly

Function Documentation

template<class T>
std::optional<T> ADS::maxProfitExactly(const std::vector<T> &prices, std::size_t k)

the largest gain of exactly k transactions on the prices, nothing if there are fewer than 2 k days