Python3 DP using Hints solution
\nclass Solution:\n    def validSequence(self, word1: str, word2: str) -> List[int]:\n        dp = [0] * (len(word1) + 1)\n        word2_size = len(word2)\n    
```\nclass Solution:\n    def validSequence(self, word1: str, word2: str) -> List[int]:\n        dp = [0] * (len(word1) + 1)\n        word2_size = len(word2)\n        word2_cp = list(word2)\n        \n        for i in range(len(word1) - 1, -1, -1):\n            w = word1[i]\n            if len(word2_cp) and w == word2_cp[-1]:\n                word2_cp.pop()\n                dp[i] = dp[i + 1] + 1\n            else:\n                dp[i] = dp[i + 1]\n        \n        word2 = deque(word2)\n        ans = []\n        changed = False\n        for i, w in enumerate(word1):\n            if not word2:\n                break\n            if w == word2[0]:\n                word2.popleft()\n                ans.append(i)\n            elif dp[i + 1] + 1 >= len(word2) and not changed:\n                word2.popleft()\n                ans.append(i)\n                changed = True\n\n        if len(ans) != word2_size:\n            return []\n        return ans\n                \n```
['Dynamic Programming', 'Python3']