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?

class Solution {
public:
bool isAnagram(string s, string t){
sort(s.begin(), s.end());
sort(t.begin(), t.end());
return s==t;
}
};

Sort-242. Valid Anagram的更多相关文章

  1. 242. Valid Anagram(C++)

    242. Valid Anagram Given two strings s and t, write a function to determine if t is an anagram of s. ...

  2. 22. leetcode 242. Valid Anagram(由颠倒字母顺序而构成的字)

    22. 242. Valid Anagram(由颠倒字母顺序而构成的字) Given two strings s and t, write a function to determine if t i ...

  3. LN : leetcode 242 Valid Anagram

    lc 242 Valid Anagram 242 Valid Anagram Given two strings s and t, write a function to determine if t ...

  4. 【LeetCode】242. Valid Anagram (2 solutions)

    Valid Anagram Given two strings s and t, write a function to determine if t is an anagram of s. For ...

  5. [leetcode]242. Valid Anagram验证变位词

    Given two strings s and t , write a function to determine if t is an anagram of s. Example 1: Input: ...

  6. LeetCode 242 Valid Anagram

    Problem: Given two strings s and t, write a function to determine if t is an anagram of s. For examp ...

  7. 242. Valid Anagram

    Given two strings s and t, write a function to determine if t is an anagram of s. For example,s = &q ...

  8. 【LeetCode】242 - Valid Anagram

    Given two strings s and t, write a function to determine if t is an anagram of s. For example,s = &q ...

  9. Java [Leetcode 242]Valid Anagram

    题目描述: Given two strings s and t, write a function to determine if t is an anagram of s. For example, ...

  10. Leetcode 242. Valid Anagram(有效的变位词)

    Given two strings s and t, write a function to determine if t is an anagram of s. For example, s = & ...

随机推荐

  1. inux中Vi不能高亮显示行号的解决办法

    适用版本:CentOS,RedHat,UBUNTU,Fedora解决办法如下: 在UBUNTU中vim的配置文件存放在/etc/vim目录中,配置文件名为vimrc 在Fedora中vim的配置文件存 ...

  2. BZOJ 1345[BOI]序列问题 - 贪心 + 单调栈

    题解 真的没有想到是单调栈啊. 回想起被单调栈支配的恐惧 最优情况一定是小的数去合并 尽量多的数,所以可以维护一个递减的单调栈. 如果加入的数比栈首小, 就直接推入栈. 如果加入的数大于等于栈首, 必 ...

  3. 设置powershell ExecutionPolicy

    Get-ExecutionPolicy -List Set-ExecutionPolicy -Scope CurrentUser AllSigned Policies: Restricted/AllS ...

  4. 22条常用JavaScript开发小技巧

    1.使用var声明变量 如果给一个没有声明的变量赋值,默认会作为一个全局变量(即使在函数内赋值).要尽量避免不必要的全局变量. 2.行尾使用分号 虽然JavaScript允许省略行尾的分号,但是有时不 ...

  5. 记录如何用abd,用电脑输出手机操作信号

    0.http://www.wmzhe.com/soft-39913.html 去这里下载最新版的adb.旧版本很多不好使.一定最新的. 1.用豌豆荚装好驱动 2.开启usb调试.具体方法可以百度到 3 ...

  6. DB2数据类型(抄袭)

    数字 数据类型        精度          最小值                                        最大值                       smal ...

  7. 2018.07.25 bzoj2125: 最短路(圆方树+倍增)

    传送门 人生的第一道仙人掌. 这道题求是仙人掌上的最短路. 先建出圆方树,然后用倍增跑最短路,当lca" role="presentation" style=" ...

  8. NATAPP打穿内网

    前一篇博文写了ngrok作为内网穿透工具现在开始开始学习另外一种内 网穿透natapp(他也是基于ngrok的一种高速内网穿透服务)多的介绍就 不说了,开始进入正题. 第一步:先登录natapp官网( ...

  9. SPSS—回归—二元Logistic回归案例分析

    数据分析真不是一门省油的灯,搞的人晕头转向,而且涉及到很多复杂的计算,还是书读少了,小学毕业的我,真是死了不少脑细胞, 学习二元Logistic回归有一段时间了,今天跟大家分享一下学习心得,希望多指教 ...

  10. MFC框架仿真<三>R T T I

    RTTI,简单的说,就是判定A类是否为B类的基类.将书本的内容最大程度的简化,如下图的类层次,现在解决的问题就是:判定“梨”是否是“红富士”的基类.