This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <vector> | |
#include <set> | |
//Just a brute force recursive solution, to be used as a first step in finding the optimal solution, i.e. by adding memoization | |
//and then possibly flipping into a table-based bottom-up solution | |
namespace with_multiset | |
{ | |
void make_change (int amount, std::vector<int> const &coins, std::set<std::multiset<int>> &changes, std::multiset<int> partial = {}) | |
{ | |
if (amount == 0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <vector> | |
#include <sstream> | |
#include <iostream> | |
#include <iterator> | |
#include <tuple> | |
template <typename T> | |
std::vector<std::string> Split(T&& input) { | |
std::stringstream ss{ std::forward<T>(input) }; | |
return std::vector<std::string> {std::istream_iterator<std::string>(ss), std::istream_iterator<std::string>{} }; |