leetcode 290[easy]----Word Pattern
来源:互联网 发布:群星修改数据 编辑:程序博客网 时间:2024/06/04 19:24
难度:easy
Given a pattern
and a string str
, find if str
follows the same pattern.
Here follow means a full match, such that there is a bijection between a letter in pattern
and a non-empty word in str
.
Examples:
- pattern =
"abba"
, str ="dog cat cat dog"
should return true. - pattern =
"abba"
, str ="dog cat cat fish"
should return false. - pattern =
"aaaa"
, str ="dog cat cat dog"
should return false. - pattern =
"abba"
, str ="dog dog dog dog"
should return false.
Notes:
You may assume pattern
contains only lowercase letters, and str
contains lowercase letters separated by a single space.
另外此处get到用split函数分割字符串(见他山之石的转载),并将字符串转化为list。
阅读全文
0 0
- <LeetCode><Easy>290 Word Pattern
- leetcode 290[easy]----Word Pattern
- Leetcode 290. Word Pattern (Easy) (cpp)
- leetcode 290: Word Pattern
- [leetcode 290]Word Pattern
- LeetCode 290 Word Pattern
- [LeetCode 290] Word Pattern
- leetcode 290 Word Pattern
- [leetcode 290] Word Pattern
- LeetCode 290 Word Pattern
- 【LEETCODE】290-Word Pattern
- LeetCode 290:Word Pattern
- leetcode 290 Word Pattern
- leetcode 290: Word Pattern
- 【LeetCode-290】Word Pattern
- LeetCode 290 Word Pattern
- leetcode 290:Word Pattern
- LeetCode[290] Word Pattern
- 计算机科学与Python编程导论_MIT 学习笔记(一)
- 问题 I: 找中间数
- 问题 J: C语言实验题——温度转换(JSU-ZJJ)
- Excel在统计分析中的应用—第九章—非参数检验-x2检验-正态分布拟合优度检验
- ZooKeeper原理及使用
- leetcode 290[easy]----Word Pattern
- NEUQ oj-1317手机键盘
- 问题 K: 圆柱体计算
- PAT 1091. Acute Stroke (30) 3重方向并查集(其实非递归DFS也可以,,)
- 从数据库提取照片文件显示到前端页面的一种方法
- 2. Add Two Numbers
- Python实现Pat 1041. Be Unique (20)
- 仿一号店布局
- 问题 L: 三角形面积