发布于2021-07-25 06:38 阅读(526) 评论(0) 点赞(10) 收藏(4)
Given two strings s and t, determine if they are isomorphic.
Two strings are isomorphic if the characters in s can be replaced to get t. [#205]
All occurrences of a character must be replaced with another character while preserving the order of characters. No two characters may map to the same character but a character may map to itself.
Examples:
Input: s = "egg", t = "add"
Output: true
Input: s = "foo", t = "bar"
Output: false
Input: s = "paper", t = "title"
Output: true
Note:
You may assume both s and t have the same length.
Given a pattern and a string str, find if str follows the same pattern. [#290]
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:
Input: pattern = "abba", str = "dog cat cat dog"
Output: true
Input:pattern = "abba", str = "dog cat cat fish"
Output: false
Input: pattern = "aaaa", str = "dog cat cat dog"
Output: false
Input: pattern = "abba", str = "dog dog dog dog"
Output: false
Note:
You may assume pattern contains only lowercase letters, and str contains lowercase letters separated by a single space.
题意:给定一个模式串,判断字符串和给定模式串是否为相同模式。
作者:风雨雷电
链接:http://www.pythonpdf.com/blog/article/428/b4a2b5784efd9b152669/
来源:编程知识网
任何形式的转载都请注明出处,如有侵权 一经发现 必将追究其法律责任
昵称:
评论内容:(最多支持255个字符)
投诉与举报,广告合作请联系vgs_info@163.com或QQ3083709327
免责声明:网站文章均由用户上传,仅供读者学习交流使用,禁止用做商业用途。若文章涉及色情,反动,侵权等违法信息,请向我们举报,一经核实我们会立即删除!