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 ...
随机推荐
- spring datasource jdbc 密码 加解密
spring datasource 密码加密后运行时解密的解决办法 - 一号门-程序员的工作,程序员的生活(java,python,delphi实战)http://www.yihaomen.com/a ...
- 转:VIM选择文本块/复制/粘贴
VIM选择文本块/复制/粘贴 - lcj_cjfykx的专栏 - CSDN博客https://blog.csdn.net/lcj_cjfykx/article/details/9091569
- 父级div宽度100%,子级一个div宽度固定,另一个宽度自适应
<!DOCTYPE html> <html> <head> <title>布局测试</title> <style type=" ...
- day 7-21 pymysql模块
一.安装的两种方法 第一种: #安装 pip3 install pymysql 第二种: 二.链接,执行sql,关闭(游标) import pymysql user = input("use ...
- 从 Aliyun 经典网络迁移到 Aliyun VPC 网络
由于阿里云策略问题,要求用户从经典网络中全部迁出,搬迁到他们设置的 VPC 网络中.这里的 VPC 大概指的是逻辑上的一个虚拟局域网.即使是实际上你的机器垮机房在阿里云的不同机房.但是他们仍然能从逻辑 ...
- linux audit审计(7-1)--读懂audit日志
auid=0 auid记录Audit user ID,that is the loginuid.当我使用lbh用户登录系统时,再访问audit_test,此时记录的auid为1001,具体日志如下: ...
- Python实现百度贴吧自动顶贴机
开发这款小工具,我们需要做一些准备: url.txt:多个需要顶起的帖子地址. reply:多条随机回复的内容. selenium:浏览器自动化测试框架 首先,我们先使用pip完成selenium的安 ...
- python numpy笔记(重要)
1.np.array 的shape (2,)与(2,1)含义 ndarray.shape:数组的维度.为一个表示数组在每个维度上大小的整数元组.例如二维数组中,表示数组的“行数”和“列数”. ndar ...
- How to enable usb on vbox
Device-->Install Guest Addition Shared Folders Settings-->Advanced-->Shared Clipboard--> ...
- 12.k8s的存储卷创建过程
数据持久化需要数据卷.kubernetes生态提供海量的存储驱动和存储使用方式. [root@master song]# cat pod-demo.yml apiVersion: v1 kind: P ...