Help with clarification

I’m not able to understand why example 3 is false

Hello @raghav007 in this example :
Input: s = “catsandog”, wordDict = [“cats”, “dog”, “sand”, “and”, “cat”]
Output:false
in this either the word should be cats or sand because s is coming in both but you cant consider them simultaneously.
this is why it is false.

for example input s = “catsand” , wordDict = [“cats”, “catsan”]
here the output would be false ? probably yes
so that means when I check for cats and the output is true I will now have to check new words after the s of cats

Yes right. you will not check for another word having s unless it has 2 s in it.
please keep this in mind we are making this condition because here is only one word is present.

also in this case first “cats” would return true then we check “and” which will return true and “og” will return false?

one more thing sir said in the video empty string will always return true but an argument can be made that it won’t because it is not present in the hashmap

og will return false yes because it has already been covered in “dog” that is why we will not check it in that.

yes empty string can be true because that means till that point you have not chosen any letter of the sequence.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.