Airbnb interview question

Leetcode problem from dp and string.