From 1880ccb6d85c6eb79e724593457877bab431951c Mon Sep 17 00:00:00 2001 From: Gloria Mundi Date: Sat, 16 Nov 2024 21:17:29 +0100 Subject: get rid of all() and sz() --- content/string/longestCommonSubsequence.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'content/string/longestCommonSubsequence.cpp') diff --git a/content/string/longestCommonSubsequence.cpp b/content/string/longestCommonSubsequence.cpp index 6c9ea44..14ca62c 100644 --- a/content/string/longestCommonSubsequence.cpp +++ b/content/string/longestCommonSubsequence.cpp @@ -1,12 +1,12 @@ string lcss(const string& a, const string& b) { - vector> m(sz(a) + 1, vector(sz(b) + 1)); - for (int i = sz(a) - 1; i >= 0; i--) { - for (int j = sz(b) - 1; j >= 0; j--) { + vector> m(ssize(a) + 1, vector(ssize(b) + 1)); + for (int i = ssize(a) - 1; i >= 0; i--) { + for (int j = ssize(b) - 1; j >= 0; j--) { if (a[i] == b[j]) m[i][j] = 1 + m[i+1][j+1]; else m[i][j] = max(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);) { + for (int j = 0, i = 0; j < ssize(b) && i < ssize(a);) { if (a[i] == b[j]) res += a[i++], j++; else if (m[i][j+1] > m[i+1][j]) j++; else i++; -- cgit v1.2.3