Uhm, the statement is pretty clear, you have a char string pattern and you also have a string with words separated by space. Your job is to tell whether string with words matches this pattern:
Each char from pattern should map to only one word ("aab"+"lol lol rofl" -> true, "aab"+"lol kek rofl" -> false)
Each word should be mapped only to one char ("abc"+"one two three" -> true, "abc"+"one two one" -> false)
There should be the same amount of words and chars ("aaa"+"lol lol lol" -> true, "aaaa"+"lol lol lol" -> false)
So following these rules test case "hut"+"unit test harpoon" should return true;
They changed the test cases now. I got it accepted with the same code. I understood the problem very clearly by the problem statement but the test cases were contradicting. Now it seems okay. :)
@raj454raj You are right. When the problem was first published we had spaces in
pattern. Now it was fixed.
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.