Leetcode 笔记
2016-01-12 20:28
281 查看
181. Employees Earning More Than Their Managers
t is an anagram of s.
For example,
s = "anagram", t = "nagaram", return true.
s = "rat", t = "car", return false.
Note:
You may assume the string contains only lowercase alphabets.
Follow up:
What if the inputs contain unicode characters? How would you adapt your solution to such case?
Subscribe to see which companies asked this question
class Solution {
public:
bool isAnagram(string s, string t) {
sort(s.begin(),s.end());
sort(t.begin(),t.end());
return s==t;
}
};
Select a.Name as Employee from Employee a inner join Employee b on a.ManagerId=b.Id where a.Salary>b.SalaryTip: inner join
242. Valid Anagram
Given two strings s and t, write a function to determine ift is an anagram of s.
For example,
s = "anagram", t = "nagaram", return true.
s = "rat", t = "car", return false.
Note:
You may assume the string contains only lowercase alphabets.
Follow up:
What if the inputs contain unicode characters? How would you adapt your solution to such case?
Subscribe to see which companies asked this question
class Solution {
public:
bool isAnagram(string s, string t) {
sort(s.begin(),s.end());
sort(t.begin(),t.end());
return s==t;
}
};
相关文章推荐
- 运行时runtime初探(强制获取并修改私有变量,强制增加及修改私有方法等)
- 机器学习(八):AdaBoost算法与实现
- C++中const相关知识
- 介绍几个程序中关于"路径字符串"的函数
- Java泛型
- 简单的缓冲区溢出试验
- hadoop_Hbase_pinpoint 环境搭建
- c++ 设计模式 代理
- 介绍几个程序中关于"路径字符串"的函数
- hdoj5430Reflect【欧拉函数】
- CodeForces--606A --Magic Spheres(模拟水题)
- 好书推荐之Java Web整合开发王者归来
- CodeForces--606A --Magic Spheres(模拟水题)
- Presorting
- LeetCode 9.Palindrome Number
- 管理员必备的20个Linux系统监控工具
- cocos2dx--两个场景切换各函数调用顺序
- 《实时控制软件设计》第三组第八天工作日志
- 2016/01/12开始学习git:版本如何回退
- 学习mongo系列(八)密码与权限