summaryrefslogtreecommitdiffstats
path: root/01-algorithmic_toolbox/04-dynamic_programming/05-lcs3/lcs3.cpp
diff options
context:
space:
mode:
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.cpp31
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;
+}