LeetCode 242 Valid Anagram
2016-04-18 17:30
253 查看
Valid Anagram
Total Accepted: 75696 TotalSubmissions: 181857 Difficulty: Easy
Given two strings s and t, write a function to determine if 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
Show Tags
Show Similar Problems
Discuss
#include<iostream> #include<string> #include <algorithm> class Solution { public: bool isAnagram(string s, string t) { sort(s.begin(),s.end()); sort(t.begin(),t.end()); return s==t; } };
相关文章推荐
- 关于协方差矩阵需要注意的一个事项
- AFHTTPSessionManager文件下载
- CentOS中yum安装软件时报错:No package XXX available
- ORA-24777: 不允许使用不可移植的数据库链路
- 2-2-for循环
- Asp.net mvc 深读mvc运行机制
- Duang,Duang,H5 +酷炫效果+干货,此时不收更待何时
- POJ 3641 Pseudoprime numbers【素数+快速幂】
- LRM-00109
- 2--线性表的链式存储
- Android studio 引用系jar包的问题
- Linux下Nagios的安装与配置
- Activiti工作流节点的自由跳转
- MySQL函数
- Android M 新的运行时权限开发者需要知道的一切
- Unity3D_NGUI_性能优化实践_CPU卡顿
- MakeFlie 经典
- Android Binder设计与实现 - 实现篇
- 利用php制作简单的文本式留言板
- torch 入门