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 ...
随机推荐
- 面象对象设计原则之七:合成复用原则(Composition/Aggregate Reuse Principle, CARP)
合成复用原则又称为组合/聚合复用原则(Composition/Aggregate Reuse Principle, CARP),其定义如下: 合成复用原则(Composite Reuse Princi ...
- Python 爬虫 解析库的使用 --- Beautiful Soup
知道了正则表达式的相关用法,但是一旦正则表达式写的有问题,得到的可能就不是我们想要的结果了.而且对于一个网页来说,都有一定的特殊结构和层级关系,而且有很多节点都有id或class来做区分,所以借助它们 ...
- java 从键盘录入的三种方法
详细内容连接 https://blog.csdn.net/StriverLi/article/details/52984066
- php 将数组转换网址URL参数
$array =array ( 'id' =123, 'name' = 'dopost' );echo http_build_query( $array );//得到结果id=123name=dopo ...
- 关于@Param
1,使用@Param注解 当以下面的方式进行写SQL语句时: @Select("select column from table where userid = #{userid} " ...
- 如何通过stat获取目录或文件的权限的数字形式
man stat 查看帮助. -c --format=FORMAT use the specified FORMAT instead of the default; output a new line ...
- OSError: mysql_config not found
使用Python3开发一个管理平台,用MySQL数据库存放元数据.使用pip安装mysqlclient模块时出现“OSError: mysql_config not found”错误. 解决: # a ...
- 使用proxychains 代理终端
最近在国外的vps上搭建了一个ss服务器,在浏览器里面设置socks5代理上网很方便, 但是终端里面却只支持http方式的代理配置,网上有socks转http代理的方式,但是最近发现一个更为简单的方式 ...
- SharePoint 2013 使用 RBS 功能将二进制大型对象 BLOB 存储在内容数据库外部。
为每个内容数据库设置 BLOB 存储 启用并配置 FILESTREAM 之后,请按照以下过程在文件系统中设置 BLOB 存储.必须为要对其使用 RBS 的每个内容数据库设置 BLOB 存储. 设置 ...
- Spring 使用介绍(九)—— 零配置(二)
三.Bean定义 1.开启bean定义注解支持 开启注解支持须添加以下配置项: <context:component-scan base-package="cn.matt"/ ...