Advertisement

290. Word Pattern 100 C++ 用户中的胜者代码

阅读量:

题目描述

Given a pattern and a string s, find if s follows the same pattern.

Following signifies a complete match, ensuring that for every character in the pattern, there exists a unique non-empty substring of s.

Example 1:

Input: pattern = “abba”, s = “dog cat cat dog”
Output: true

Example 2:

Input: pattern = “abba”, s = “dog cat cat fish”
Output: false

Example 3:

Input: pattern = “aaaa”, s = “dog cat cat dog”
Output: false

Example 4:

Input: pattern = “jquery”, s = “jquery”
Output: false

Constrains:

  • patte

全部评论 (0)

还没有任何评论哟~