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?

Anagram,相同字母异序词

=========

class {
public:
bool isAnagram(string s, string t) {
if(s.size() != t.size()) return false;
sort(s.begin(),s.end());
sort(t.begin(),t.end());
int n = s.size();
for(int i = ;i<n;i++){
if(s[i]!=t[i]) return false;
}
return true;
}
};

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. 【leetcode❤python】242. Valid Anagram

    class Solution(object):    def isAnagram(self, s, t):        if sorted(list(s.lower()))==sorted(list ...

  8. (easy)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. 【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 ...

随机推荐

  1. 纯JavaScrip图表插件——Highcharts

    简介 Highcharts 是一个用纯JavaScript编写的一个图表库, 能够很简单便捷的在web网站或是web应用程序添加有交互性的图表,并且免费提供给个人学习.个人网站和非商业用途使用.目前H ...

  2. BAPI 使用

    BAPI_ACC_DOCUMENT_POST *---BAPI_ACC_DOCUMENT_POST 所需要的参数  DATA: OBJ_TYPE LIKE BAPIACHE09-OBJ_TYPE,   ...

  3. php 滑动验证码

    自己研究: jQuery拖拽滑动验证码插件 slideunlock.js 原理:(别人说) 响应时间,拖拽速度,时间,位置,轨迹,重试次数等.这些因素能够构成一个采样结果或者辨识特性. 只获取到滑动时 ...

  4. Matlab 矩阵卷积理解(转载)

    转载自:http://blog.csdn.net/andrewseu/article/details/51783181 在图像处理的过程中,经常会看到矩阵卷积的概念,比如说用一个模板去和一张图片进行卷 ...

  5. Spring事务管理 -- 挺好

    Spring是SSH中的管理员,负责管理其它框架,协调各个部分的工作.今天一起学习一下Spring的事务管理.Spring的事务管理分为声明式跟编程式.声明式就是在Spring的配置文件中进行相关配置 ...

  6. MATLAB格式化输出控制 分类: 数学 2015-07-31 23:01 3人阅读 评论(0) 收藏

    MATLAB格式化输出控制 format 默认格式 format short 5字长定点数 format long 15字长定点数 format short e 5字长浮点数 format long ...

  7. 最小二乘法 java

    import java.util.ArrayList; import java.util.Collection; import org.apache.commons.math3.optim.Point ...

  8. Apache的虚拟主机配置

    使用虚拟主机要先取消中心主机,注释掉DocumentRoot #DocumentRoot "/www/htdoc" 虚拟主机的单独配置: 用户认证 访问日志 错误日志 别名 脚本别 ...

  9. 【转】iOS websocket 及时通讯实现

    原文网址:http://blog.csdn.net/manyxh/article/details/48196209 2015-09-03 by 木易哥哥 开发一个类似QQ.微信的即时IM聊天功能,做到 ...

  10. 论文笔记之:Heterogeneous Image Features Integration via Multi-Modal Semi-Supervised Learning Model

    Heterogeneous Image Features Integration via Multi-Modal Semi-Supervised Learning Model ICCV 2013 本文 ...