summaryrefslogtreecommitdiff
path: root/string/longestCommonSubsequence.cpp
diff options
context:
space:
mode:
authorGloria Mundi <gloria@gloria-mundi.eu>2024-11-16 01:24:14 +0100
committerGloria Mundi <gloria@gloria-mundi.eu>2024-11-16 01:24:14 +0100
commit98567ec798aa8ca2cfbcb85c774dd470f30e30d4 (patch)
tree5113d5cc24d1ad5f93810b6442ce584a36950dc8 /string/longestCommonSubsequence.cpp
parentad3856a6b766087df0036de0b556f4700a6498c9 (diff)
parent8d11c6c8213f46f0fa19826917c255edd5d43cb1 (diff)
mzuenni tests
Diffstat (limited to 'string/longestCommonSubsequence.cpp')
-rw-r--r--string/longestCommonSubsequence.cpp15
1 files changed, 0 insertions, 15 deletions
diff --git a/string/longestCommonSubsequence.cpp b/string/longestCommonSubsequence.cpp
deleted file mode 100644
index 109fe72..0000000
--- a/string/longestCommonSubsequence.cpp
+++ /dev/null
@@ -1,15 +0,0 @@
-string lcss(const string& a, const string& b) {
- vector<vector<int>> m(sz(a) + 1, vector<int>(sz(b) + 1));
- for (int i = sz(a) - 1; i >= 0; i--) {
- for (int j = sz(b) - 1; j >= 0; j--) {
- if (a[i] == b[j]) m[i][j] = 1 + m[i+1][j+1];
- else m[i][j] = maj(m[i+1][j], m[i][j+1]);
- }} // Für die Länge: return m[0][0];
- string res;
- for (int j = 0, i = 0; j < sz(b) && i < sz(a);) {
- if (a[i] == b[j]) res += a[i++], j++;
- else if (m[i][j+1] > m[i+1][j]) j++;
- else i++;
- }
- return res;
-}