Explain testcase "h u t" "unit test harpoon"

  • 1

    Worst problem statement ever! Please explain and re-write the problem statement.

  • 0

    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:

    1. Each char from pattern should map to only one word ("aab"+"lol lol rofl" -> true, "aab"+"lol kek rofl" -> false)

    2. Each word should be mapped only to one char ("abc"+"one two three" -> true, "abc"+"one two one" -> false)

    3. 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;

  • 0

    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. :)

  • 0

    @raj454raj You are right. When the problem was first published we had spaces in pattern. Now it was fixed.

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.