Problem was not normal, Here's the solution 👍
Complexity\n- Time complexity:\nTC = O(N)\n\n- Space complexity:\nSC = O(N)\n\n# Code\ncpp []\nclass Solution {\npublic:\n    vector<int> validSequence(string s
# Complexity\n- **Time complexity:\nTC = O(N)**\n\n- **Space complexity:\nSC = O(N)**\n\n# Code\n```cpp []\nclass Solution {\npublic:\n    vector<int> validSequence(string s1, string s2) {\n        int n = s1.size(), m = s2.size();\n\n        // make \'v\' vector of size n, which stores index j, this indicates from j index I can match further to the last of the string s2\n        int j = m-1;\n        vector<int> v(n, 0);\n        //pushing \'m\' which is s2.size() into the vector for having synchronization in the approach otherwise we need to handle (n-1)th index of v in a different way\n        v.push_back(m);\n\n        // making \'v\' vector: stores index j at index i which indicates from this j to the end of string s2, we can match the pattern\n        for(int i=n-1; i>=0; i--){\n            v[i] = v[i+1];\n            if(j>=0 && s1[i] == s2[j]){\n                v[i] = j;\n                j--;\n            }\n        }\n\n        // take swapInd to find the index i which need to be swapped to make it equal to j\n        j = 0;\n        int swapInd = -1;\n\n        for(int i=0; i<n; i++){\n            if(s1[i] == s2[j]){\n                j++;\n            } else if(v[i+1] <= j+1){\n                swapInd = j;\n                break;\n            }\n        }\n\n        // now, start iterating till i<n && j<m \n        j=0;\n        vector<int> ans;\n\n        for(int i=0; i<n && j<m; i++){\n            if(j==swapInd){\n                ans.push_back(i);\n                j++;\n            } else if(s1[i] == s2[j]){\n                ans.push_back(i);\n                j++;\n            }\n        }\n\n        return ans.size() < m ? vector<int>(0) : ans;\n    }\n};\n```
['String', 'C++']