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/05-lcs3/lcs3.cpp | |
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/05-lcs3/lcs3.cpp')
-rw-r--r-- | 01-algorithmic_toolbox/04-dynamic_programming/05-lcs3/lcs3.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/01-algorithmic_toolbox/04-dynamic_programming/05-lcs3/lcs3.cpp b/01-algorithmic_toolbox/04-dynamic_programming/05-lcs3/lcs3.cpp new file mode 100644 index 0000000..2ca0339 --- /dev/null +++ b/01-algorithmic_toolbox/04-dynamic_programming/05-lcs3/lcs3.cpp @@ -0,0 +1,31 @@ +#include <iostream> +#include <vector> + +using std::vector; + +int lcs3(vector<int> &a, vector<int> &b, vector<int> &c) { + //write your code here + return std::min(std::min(a.size(), b.size()), c.size()); +} + +int main() { + size_t an; + std::cin >> an; + vector<int> a(an); + for (size_t i = 0; i < an; i++) { + std::cin >> a[i]; + } + size_t bn; + std::cin >> bn; + vector<int> b(bn); + for (size_t i = 0; i < bn; i++) { + std::cin >> b[i]; + } + size_t cn; + std::cin >> cn; + vector<int> c(cn); + for (size_t i = 0; i < cn; i++) { + std::cin >> c[i]; + } + std::cout << lcs3(a, b, c) << std::endl; +} |