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 ...
随机推荐
- PHP开发编码规范
(转载:https://blog.csdn.net/alexdream/article/details/2213313) 这些年来多从事Linux下PHP和C相关的开发,带过很多项目和团队,下面是根据 ...
- laravel 循环中子元素使用&符号嵌入到父级,经典版
/**ajax 获取企业名称 * * @param Request $request * * @return \Illuminate\Http\JsonResponse * @author lxw * ...
- day 7-5 守护线程
一. 守护线程 无论是进程还是线程,都遵循:守护进程(线程)会等待主进程(线程)运行完毕后被销毁. 需要强调的是:运行完毕并非终止运行. 1.对主进程来说,运行完毕指的是主进程代码运行完毕. 2.对主 ...
- HTML4到HTML5
第一步: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0.1//EN" "http://www.w3.org/TR/html ...
- Linux 的相关操作
切换权限 在linux环境下,用户之前的切换使用 “su - name,若要切换到root下面,则使用sudo su 命令即可. 在linux下安装软件,经常就是装完后不知道装到哪里去了 (201 ...
- java中级——二叉树比较冒泡和选择排序
上次我们说到二叉树排序比较,给出如下的题目 题目:创建五万个随机数,然后用分别用冒泡法,选择法,二叉树3种排序算法进行排序,比较哪种更快 废话不说直接上源码,可以看控制台结果 注意的是 需要我们需要上 ...
- Django--cookie 和 session
一 . 会话跟踪 简单来说就是如果谢霆锋登录了淘宝,然后他点击淘宝内的任何连接就不需要在登录了,这是由于这个会话中数据共享, 也就是会话跟踪, 我们都知道http协议是短连接 无状态的,也就是说你登录 ...
- GlusterFS卷的种类
1.分布卷 在分布式卷中,文件随机扩展到卷中的砖块中. 使用分布式卷,需要扩展存储和冗余不是很重要,或由其他硬件/软件层提供. 创建语法:gluster volume create [transpor ...
- 使用mysqlbinlog恢复数据
前提:mysql数据库开启了binlog日志,并且有对应的日志文件 起因:今天由于同事对数据库的误操作不小心删除了一条数据 方法一:通过binlog日志文件恢复数据 通过mysqlbinlog恢复My ...
- 在页面中有overflow-y:auto属性的div,当出现滚动条,点击返回顶部按钮,内容回这个div最顶部
<!doctype html> <html lang="en"> <head> <meta charset="UTF-8&quo ...