HR_Hash Tables: Ransom Note
1 题目重点:whole words | case-sensitive
#!/bin/python3 import math
import os
import random
import re
import sys # Complete the checkMagazine function below.
def checkMagazine(magazine, note):
# m_len magazine n_len note
m_len = len(magazine)
n_len = len(note)
# magazine = sorted(magazine)
# note = sorted(note)
for i in range(n):
try:
temp = magazine.index(note[i])
magazine[temp] = 0
except ValueError:
return 'No'
return 'Yes' if __name__ == '__main__':
mn = input().split() m = int(mn[0]) n = int(mn[1]) magazine = input().rstrip().split() note = input().rstrip().split() print(checkMagazine(magazine, note))
HR_Hash Tables: Ransom Note的更多相关文章
- [LeetCode] Ransom Note 赎金条
Given an arbitrary ransom note string and another string containing letters from all th ...
- leetcode 383. Ransom Note
Given an arbitrary ransom note string and another string containing letters from all th ...
- 383. Ransom Note
Given an arbitrary ransom note string and another string containing letters from all th ...
- leetcode修炼之路——383. Ransom Note
题目是这样的 Given an arbitrary ransom note string and another string containing letters from a ...
- 14. leetcode 383. Ransom Note
Given an arbitrary ransom note string and another string containing letters from all the magazines, ...
- Ransom Note(383)
题目:Given an arbitrary ransom note string and another string containing letters from all the magazine ...
- [Swift]LeetCode383. 赎金信 | Ransom Note
Given an arbitrary ransom note string and another string containing letters from all the magazines, ...
- [LeetCode&Python] Problem 383. Ransom Note
Given an arbitrary ransom note string and another string containing letters from all the magazines, ...
- leetcode之Ransom Note
题目描述: Given an arbitrary ransom note string and another string containing letters from a ...
随机推荐
- shell脚本--php执行普通shell命令
这里只演示一些普通的shell命令,一些需要root用户权限执行的命令,请参考:php以root权限执行shell命令 php执行shell命令,可以使用下面几个函数: string system ( ...
- 【kindle笔记】之 《解忧杂货店》-2018-3-13
[kindle笔记]读书记录-总 <解忧杂货店>-2018-3-13 东野的大ID加上此书的大ID,今天终于在回来天津的火车上一口气读完了. 此前在微信读书上看过这本书,只看了前一部分,感 ...
- ~/.bashrc与/etc/profile的区别
~/.bashrc:该文件包含专用于某个用户的bash shell的bash信息,当该用户登录时以及每次打开新的shell时,该文件被读取. /etc/profile中设定的变量(全局)的可以作用于任 ...
- 认识Debian
Debian -- 通用操作系统https://www.debian.org/ DebianStretch - Debian Wikihttps://wiki.debian.org/DebianStr ...
- Hibernate two table same id
Hibernate更新数据(不用update也可以) - 森林木马 - 博客园 https://www.cnblogs.com/owenma/p/3481497.html hibernate级联更新会 ...
- JEECG SSO kisso
kisso: java 基于 Cookie 的 SSO 中间件 kisso https://gitee.com/baomidou/kisso kisso首页.文档和下载 - 基于 Cookie 的 S ...
- md5加密通过URL传给后台
首先要把你要用的md5库引入 这个技术其实挺简单的,咋们直接贴上代码(这个是项目上的) sign = hex_md5("type="+type&"userId=& ...
- fork分支与源分支同步代码
最进软件工程课程要团队开发做个网站项目,于是我在团队里推了使用github这种网站来协同开发,但是出现了个问题:fork后的代码无法 与源分支代码同步,导致fork分支的代码只有自己写的那部分,而不是 ...
- java.util (Collection接口和Map接口)
1:Collection和Map接口的几个主要继承和实现类 1.1 Collection接口 Collection是最基本的集合接口,一个Collection代表一 ...
- Spring 配置详解
spring4配置文件详解 一.配置数据源 基本的加载properties配置文件 <context:property-placeholder location="classpath* ...