Dev
Mentor
Coach Interview AI
Mock Interview AI
Coding Problems
Blog
Pricing
Toggle theme
Sign In
Get Started
Toggle theme
Loading...
For the best coding experience, use a desktop browser.
Easy
Hash Table
Word Pattern
Given
pattern
and
s
, determine if
s
follows the same pattern.
Examples
Input:
pattern = "abba", s = "dog cat cat dog"
Output:
true
Sample Test Cases
Case 1 Input:
"abba" "dog cat cat dog"
Expected:
true
Case 2 Input:
"abba" "dog cat cat fish"
Expected:
false
Reset
Run
Submit
Loading editor...
Test Case
Output
Submission
Case 1 Input:
"abba" "dog cat cat dog"
Expected:
true
Case 2 Input:
"abba" "dog cat cat fish"
Expected:
false