Three servers each logged a sequence of event codes, written as the strings a, b and c (one letter per event). Events may be missing from any log, but the ones present keep their order. Return the length of the longest sequence of events that appears, in order, in all three logs (not necessarily contiguously).
Examples
Input: a = "apple", b = "maple", c = "ample"
Output: 4
Explanation: "aple" appears in order in all three.
Input: a = "abc", b = "abd", c = "xyz"
Output: 0
Constraints
0 <= len(a), len(b), len(c) <= 50- lowercase letters only
- Target complexity: O(len(a) * len(b) * len(c)). Computing the answer for two logs first and then comparing with the third does not work.
Goals
- Extend a two-string subsequence table to three strings
- Keep the memory manageable with rolling layers