problem

953. Verifying an Alien Dictionary

solution:

class Solution {
public:
bool isAlienSorted(vector<string>& words, string order) {
unordered_map<char, int> alien_order;
for(int i=; i<order.size(); i++)
{
alien_order[order[i]-'a'] = i;
}
for(auto &word:words)
{
for(auto &ch:word)
{
ch = alien_order[ch-'a'];
}
}
return is_sorted(words.begin(), words.end()); }
};

参考

1. Leetcode_easy_953. Verifying an Alien Dictionary;

2. dicuss;

【Leetcode_easy】953. Verifying an Alien Dictionary的更多相关文章

  1. 【leetcode】953. Verifying an Alien Dictionary

    题目如下: In an alien language, surprisingly they also use english lowercase letters, but possibly in a ...

  2. 【LeetCode】953. Verifying an Alien Dictionary 解题报告(Python)

    作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 日期 题目地址:https://leetcode.c ...

  3. 953.Verifying an Alien Dictionary(Map)

    In an alien language, surprisingly they also use english lowercase letters, but possibly in a differ ...

  4. LeetCode 953 Verifying an Alien Dictionary 解题报告

    题目要求 In an alien language, surprisingly they also use english lowercase letters, but possibly in a d ...

  5. LeetCode 953. Verifying an Alien Dictionary

    原题链接在这里:https://leetcode.com/problems/verifying-an-alien-dictionary/ 题目: In an alien language, surpr ...

  6. 【Leetcode_easy】720. Longest Word in Dictionary

    problem 720. Longest Word in Dictionary 题意: solution1: BFS; class Solution { public: string longestW ...

  7. LeetCode 953. Verifying an Alien Dictionary (验证外星语词典)

    题目标签:HashMap 题目给了我们一个 order 和 words array,让我们依照order 来判断 words array 是否排序. 利用hashmap 把order 存入 map, ...

  8. Verifying an Alien Dictionary

    2019-11-24 22:11:30 953. Verifying an Alien Dictionary 问题描述: 问题求解: 这种问题有一种解法是建立新的排序和abc排序的映射,将这里的str ...

  9. LeetCode.953-验证外语字典顺序(Verifying an Alien Dictionary)

    这是悦乐书的第364次更新,第392篇原创 01 看题和准备 今天介绍的是LeetCode算法题中Easy级别的第226题(顺位题号是953).在外语中,令人惊讶的是,他们也使用英文小写字母,但可能使 ...

随机推荐

  1. jupyter安装小结

    jupyter安装小结 更新时间:2016年03月13日 15:42:37   投稿:hebedich    我要评论 jupyter (之前的 ipython notebook )于我的最大意义在于 ...

  2. C# Dictionary使用

    Dictionary<string, int> illegParking = new Dictionary<string, int>(); 键:inData.LOTID 值:i ...

  3. 通过django-crontab扩展来实现 定时任务

    pip install django-crontab 基本格式 : * * * * * 分 时 日 月 周 命令 M: 分钟(0-59).每分钟用*或者 */1表示 H:小时(0-23).(0表示0点 ...

  4. #505. 「LibreOJ β Round」ZQC 的游戏

    题目描述 首先一定是让ZQC吃掉他能吃到的所有的球,这样才能尽可能的满足ZQC的质量是所有玩家中最大的. 在满足某一个玩家的质量不会超过ZQC的情况下,让这个玩家吃掉尽可能多的球,让其他玩家吃掉的尽可 ...

  5. maven ssm 编译异常记录:

    maven ssm 编译异常记录: javax.servlet.jsp 解决: 清除 tomacat libraries 修改 pom 文件 <dependency> <groupI ...

  6. jmeter非GUI界面常用参数详解

    压力测试或者接口自动化测试常常用到的jmeter非GUI参数,以下记录作为以后的参考 讲解:非GUI界面,压测参数讲解(欢迎加入QQ群一起讨论性能测试:537188253) -h 帮助 -n 非GUI ...

  7. Atcoder Grand Contest 026 (AGC026) F - Manju Game 博弈,动态规划

    原文链接www.cnblogs.com/zhouzhendong/AGC026F.html 前言 太久没有发博客了,前来水一发. 题解 不妨设先手是 A,后手是 B.定义 \(i\) 为奇数时,\(a ...

  8. T-MAX组--项目冲刺(第七天)

    THE SEVENTH DAY 项目相关 作业相关 具体描述 所属班级 2019秋福大软件工程实践Z班 作业要求 团队作业第五次-项目冲刺 作业正文 T-MAX组--项目冲刺(第七天) 团队名称 T- ...

  9. python 画园和椭圆

    from matplotlib.patches import Ellipse, Circle import matplotlib.pyplot as plt fig = plt.figure() ax ...

  10. Word 软回车和硬回车

    网页上复制一大段内容,会发现很多向下的箭头,这种叫软回车,要如何批量替换成常见的硬回车呢?   工具/原料   word文档 方法/步骤   1 先认识这种向下的箭头,这种回车形式叫软回车,按shif ...