Java || Easy Solution
\nclass Solution {\n    \n    /*\n    * So, the main tricky point in this question is to find the indexs of the Strings in w, the characters of w must be in s w
```\nclass Solution {\n    \n    /*\n    * So, the main tricky point in this question is to find the indexs of the Strings in w, the characters of w must be in s with the same count of character as well as indexes need to be proper\n    * for example (two pointer approach): w : "abc" and s : "aaabbbc" -> this is true.\n    *               w : "abc" and s : "aaaacbb" -> this is false, because we fill find out the character b at index after index of c, and we can\'t go back to match \'c\'.\n    *\n    * The brute force approach is looping over s and every String in w :- > TC : O(5*10^4 * 5000 * 50) -> O(125 * 10^8) -> TLE\n    * So, to map the characters from s -> t, we can use a hashMap, and to map the indexes, we can use a arraylist of indexed for specific characters. eg : HashMap<Character, ArrayList<Integer>>\n    * now, whenever we find a character, we know that the next character index should be greater than current one. So, we can simply search the index of next largest index, of the character.\n    * If we are able to find that, then the subsequence will exist, else not.\n    *\n    * this approach is (HashMap + Binary Search), in worst case we have 26 == O(1) characters : TC : O(5000*50*log(50))\n    * */\n    \n    public int numMatchingSubseq(String s, String[] words) {\n\n        int count = 0;\n        HashMap<Character, ArrayList<Integer>> hashMap = new HashMap<>();\n\n        for(int i = 0; i < s.length(); i++){\n\n            if(hashMap.containsKey(s.charAt(i))){\n                hashMap.get(s.charAt(i)).add(i);\n            }else{\n                ArrayList<Integer> list = new ArrayList<>();\n                list.add(i);\n                hashMap.put(s.charAt(i), list);\n            }\n\n        }\n\n        for(String w : words){\n\n            if(isSubseq(w, hashMap, s)) count++;\n\n        }\n        return count;\n    }\n\n    public boolean isSubseq(String w, HashMap<Character, ArrayList<Integer>> hashMap, String s){\n\n        int low = -1;\n\n        for(int i = 0; i < w.length(); i++){\n            if(hashMap.containsKey(w.charAt(i))){\n                if(low == -1){\n                    low = hashMap.get(w.charAt(i)).get(0);\n                }else{\n                    low = getIndex(hashMap.get(w.charAt(i)), low);\n\n                    if(low == -1){\n                        return false;\n                    }\n                }\n            }else{\n                return false;\n            }\n        }\n        return true;\n    }\n\n    private int getIndex(ArrayList<Integer> list, int low) {\n        int s = 0;\n        int e = list.size()-1;\n        int ans = -1;\n\n        while (s <= e){\n            int mid = s + (e - s)/2;\n\n            if(list.get(mid) > low){\n                ans = list.get(mid);\n                e = mid-1;\n            }else {\n                s = mid+1;\n            }\n        }\n\n        return ans;\n    }\n}\n```
['Binary Tree', 'Java']