Skip to content

Latest commit

 

History

History
 
 

290.Word_Pattern

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

290. Word Pattern (Easy)

链接

题目:https://leetcode.com/problems/word-pattern/
代码(github):https://github.com/illuz/leetcode

题意

给出 pattern 和 str,问 pattern 里的字符串和 str 里的单词是否一一配对。

分析

可以先对 str 进行分词,也可以一边遍历 pattern 一边分词。
字符->字符串 可以用 map 也可以用 array。