c++ easy check a couple idx then magic 904 WEAK tc passes
Complexity\n- Time complexity: O(n)\n- Space complexity: O(n)\n\n# Code\n### 300ms (only beats ~20%)\ncpp []\nbool fio() {\n    ios::sync_with_stdio(0);\n    ci
# Complexity\n- Time complexity: $$O(n)$$\n- Space complexity: $$O(n)$$\n\n# Code\n### 300ms (only beats ~20%)\n```cpp []\nbool fio() {\n    ios::sync_with_stdio(0);\n    cin.tie(0);\n    return 1;\n}\nbool c = fio();\nclass Solution {\npublic:\n    vector<int> validSequence(const string& word1, const string& word2) {\n        auto attempt = [&](int diff) -> vector<int> {\n            vector<int> res;\n            int p = 0;\n            for(int i = 0, n = word1.length(), w2n = word2.length(); i < n && p < w2n; i++) {\n                if(p == diff) {\n                    res.push_back(i);\n                    p++;\n                    continue;\n                }\n                if(word1[i] == word2[p]) {\n                    res.push_back(i);\n                    p++;\n                }\n            }\n            if(res.size() == word2.length()) {\n                return res;\n            }else return {};\n        };\n        vector<int> res;\n        for(int bb : {0, 1, 2, 3, 4, 5, 13, (int) word2.length()/2}) { // midChar is crucial\n            vector<int> b = attempt(bb);\n            if(!b.empty() && (res.empty() || b < res)) {\n                res = b;\n            }\n        }\n        return res;\n    }\n};\n```
['String', 'C++']