This is Shortest Common Supersequence from LeetCode. Given two strings, find the shortest string that has both as subsequences. For "abac" and "cab", the answer is "cabac". This is the inverse of LCS.
Instead of finding the longest common part, you're building the shortest string containing both. Read the constraints carefully, especially the input size. This tells you what time complexity you need. Try to find the recursive structure: how does solving smaller instances help solve the full problem?