String Permutation
来源:互联网 发布:福州锐掌网络怎么样 编辑:程序博客网 时间:2024/06/06 19:19
Given two strings, write a method to decide if one is a permutation of the other.
python
class Solution: """ @param: A: a string @param: B: a string @return: a boolean """ def Permutation(self, A, B): # write your code here if A is None and B is not None: return False if A is not None and B is None: return False if A is None and B is None: return True if len(A) != len(B): return False arr = [0] * 256 for ele in list(A): arr[ord(ele)] += 1 for val in list(B): arr[ord(val)] -= 1 if arr[ord(val)] < 0: return False return True
阅读全文
0 0
- String permutation
- String Permutation
- String Permutation
- Algorithm: String Full Permutation
- string permutation, anagram
- [LinkedIn] String Permutation
- String Permutation java solution
- Permutation in String
- 567. Permutation in String
- Permutation in String
- LeetCode567. Permutation in String
- 567. Permutation in String
- 567Permutation in String
- 567. Permutation in String
- Leetcode60 Permutation Sequence (string)
- 567. Permutation in String
- [LintCode] 字符串置换 String Permutation
- [leetcode]567. Permutation in String
- sdut 3361迷宫探索dfs
- Can you answer these queries I (线段树)
- linux 安装tensorflow
- varchar和Nvarchar区别
- QML使用PinchArea实现捏拉缩放与旋转并单手拖放控件
- String Permutation
- 投筛子游戏
- python常用模块整理
- 小白学数据结构——二、树与堆(基本概念及二叉树、二叉堆的python实现)
- word转pdf代码
- session机制描述
- Intellij IDEA 配置 Tomcat
- 解决应用的反调试方案解析(修改IDA调试端口修改内核信息)
- 关于Kinect突然无法启动问题的解决方案