diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2016-11-13 21:18:32 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2016-11-13 21:18:32 +0100 |
commit | bc75b20fc0e80d6037ee14e3dccc2d88823f5f2f (patch) | |
tree | a45d61c5be8df717a28904d434287b88d94a1843 /01-algorithmic_toolbox/04-dynamic_programming/04-placing_parentheses | |
parent | 36260c39bee50e6160c99e240fcad63402e39346 (diff) | |
download | coursera-bc75b20fc0e80d6037ee14e3dccc2d88823f5f2f.zip coursera-bc75b20fc0e80d6037ee14e3dccc2d88823f5f2f.tar.gz |
Algorithms : add 01-algorithmic_toolbox 04-dynamic_programming
Diffstat (limited to '01-algorithmic_toolbox/04-dynamic_programming/04-placing_parentheses')
5 files changed, 36 insertions, 0 deletions
diff --git a/01-algorithmic_toolbox/04-dynamic_programming/04-placing_parentheses/placing_parentheses.cpp b/01-algorithmic_toolbox/04-dynamic_programming/04-placing_parentheses/placing_parentheses.cpp new file mode 100644 index 0000000..06861ab --- /dev/null +++ b/01-algorithmic_toolbox/04-dynamic_programming/04-placing_parentheses/placing_parentheses.cpp @@ -0,0 +1,32 @@ +#include <iostream> +#include <cassert> +#include <string> +#include <vector> + +using std::vector; +using std::string; +using std::max; +using std::min; + +long long eval(long long a, long long b, char op) { + if (op == '*') { + return a * b; + } else if (op == '+') { + return a + b; + } else if (op == '-') { + return a - b; + } else { + assert(0); + } +} + +long long get_maximum_value(const string &exp) { + //write your code here + return 0; +} + +int main() { + string s; + std::cin >> s; + std::cout << get_maximum_value(s) << '\n'; +} diff --git a/01-algorithmic_toolbox/04-dynamic_programming/04-placing_parentheses/tests/01 b/01-algorithmic_toolbox/04-dynamic_programming/04-placing_parentheses/tests/01 new file mode 100644 index 0000000..cea3f71 --- /dev/null +++ b/01-algorithmic_toolbox/04-dynamic_programming/04-placing_parentheses/tests/01 @@ -0,0 +1 @@ +1+5 diff --git a/01-algorithmic_toolbox/04-dynamic_programming/04-placing_parentheses/tests/01.a b/01-algorithmic_toolbox/04-dynamic_programming/04-placing_parentheses/tests/01.a new file mode 100644 index 0000000..1e8b314 --- /dev/null +++ b/01-algorithmic_toolbox/04-dynamic_programming/04-placing_parentheses/tests/01.a @@ -0,0 +1 @@ +6 diff --git a/01-algorithmic_toolbox/04-dynamic_programming/04-placing_parentheses/tests/02 b/01-algorithmic_toolbox/04-dynamic_programming/04-placing_parentheses/tests/02 new file mode 100644 index 0000000..92a372d --- /dev/null +++ b/01-algorithmic_toolbox/04-dynamic_programming/04-placing_parentheses/tests/02 @@ -0,0 +1 @@ +5-8+7*4-8+9 diff --git a/01-algorithmic_toolbox/04-dynamic_programming/04-placing_parentheses/tests/02.a b/01-algorithmic_toolbox/04-dynamic_programming/04-placing_parentheses/tests/02.a new file mode 100644 index 0000000..08839f6 --- /dev/null +++ b/01-algorithmic_toolbox/04-dynamic_programming/04-placing_parentheses/tests/02.a @@ -0,0 +1 @@ +200 |