Two teams each keep an ordered list of tasks written as a string (a and b, one lowercase letter per task). A single merged schedule must contain every task of a in order and every task of b in order; a task letter may be shared by both teams. Return the length of the shortest possible merged schedule.
Examples
Input: a = "cattle", b = "battle"
Output: 7
Explanation: "cbattle" contains both as subsequences.
Input: a = "abc", b = "abc"
Output: 3
Constraints
0 <= len(a), len(b) <= 300- Lowercase letters only.
- Target complexity: O(len(a) * len(b)).
Goals
- Reduce a supersequence question to a common-subsequence table
- Handle empty strings through the table's zero row and column