This is Edit Distance from LeetCode, also called Levenshtein Distance. Given two strings, find the minimum operations to convert one to the other. You can insert, delete, or replace a character. For "horse" and "ros": horse → rorse → rose → ros. Three operations. 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?