【leetcode❤python】Find the Difference
#-*- coding: UTF-8 -*-
class Solution(object):
def findTheDifference(self, s, t):
s=sorted(list(s))
t=sorted(list(t))
for st in s:
p=t.index(st)
del t[p]
return ''.join(t)
sol=Solution()
print sol.findTheDifference('abddcde', 'eabadbdccdde')
【leetcode❤python】Find the Difference的更多相关文章
- 【leetcode❤python】Sum Of Two Number
#-*- coding: UTF-8 -*- #既然不能使用加法和减法,那么就用位操作.下面以计算5+4的例子说明如何用位操作实现加法:#1. 用二进制表示两个加数,a=5=0101,b=4=0100 ...
- 【leetcode❤python】 1. Two Sum
#-*- coding: UTF-8 -*- #AC源码[意外惊喜,还以为会超时]class Solution(object): def twoSum(self, nums, target): ...
- 【leetcode❤python】 58. Length of Last Word
#-*- coding: UTF-8 -*-#利用strip函数去掉字符串去除空格(其实是去除两边[左边和右边]空格)#利用split分离字符串成列表class Solution(object): ...
- 【leetcode❤python】 8. String to Integer (atoi)
#-*- coding: UTF-8 -*-#需要考虑多种情况#以下几种是可以返回的数值#1.以0开头的字符串,如01201215#2.以正负号开头的字符串,如'+121215':'-1215489' ...
- 【leetcode❤python】 165. Compare Version Numbers
#-*- coding: UTF-8 -*-class Solution(object): def compareVersion(self, version1, version2): ...
- 【leetcode❤python】 168. Excel Sheet Column Title
class Solution(object): def convertToTitle(self, n): """ :type n: in ...
- 【leetcode❤python】 7. Reverse Integer
#-*- coding: UTF-8 -*-#2147483648#在32位操作系统中,由于是二进制,#其能最大存储的数据是1111111111111111111111111111111.#正因为此, ...
- 【leetcode❤python】 189. Rotate Array
#-*- coding: UTF-8 -*-#由于题目要求不返回任何值,修改原始列表,#因此不能直接将新生成的结果赋值给nums,这样只是将变量指向新的列表,原列表并没有修改.#需要将新生成的结果赋予 ...
- 【leetcode❤python】 278. First Bad Version
#-*- coding: UTF-8 -*-# The isBadVersion API is already defined for you.# @param version, an integer ...
随机推荐
- jq 换图片路径
$("#index_01")[0].src="images/index_01_1.jpg"; //更改ID为index_01的图片的src值 $("# ...
- Linux mysql 主从复制
主:192.168.246.130 从:192.168.246.131 主配制:my.conf server_id log-bin=mysql-bin binlog-format=mixed 从配制: ...
- 算法第四版 在Eclipse中调用Algs4库
首先下载Eclipse,我选择的是Eclipse IDE for Java Developers64位版本,下载下来之后解压缩到喜欢的位置然后双击Eclipse.exe启动 然后开始新建项目,File ...
- 「thunar」给thunar增加搜索文件功能
1.安装catfish sudo apt-get install catfish 2.配置thunar,添加[自定义动作] 打开 Thunar 后,点击 Edit -> Configure cu ...
- Delphi中使用@取函数地址的问题(转)
Delphi中使用@取函数地址的问题 例如以下代码:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes ...
- $(document).ready vs $(window).load vs window.onload
原文地址: $(document).ready vs $(window).load vs window.onload $(document).ready We execute our code whe ...
- DataGuard主备归档存在gap的处理办法
DataGuard主备之间可能由于网络等原因,造成备库和主库之间的归档日志不一致,这样就产生了gap. 解决gap的步骤: 1.在备库获得gap的详细信息 2.将需要的归档日志从主库拷贝到备库 3.备 ...
- 几个常见的Laravel报错及解决方法
报错:「Can't swap PDO instance while within transaction」 transactions >= 1) {throw new RuntimeExcept ...
- ACM题目————已知前序和中序求后序
#include <iostream> #include <cstring> #include <cstdio> using namespace std; ], z ...
- PreparedStatement接口及其方法的使用
PreparedStatement接口是Statement接口的子接口,使用它的好处有三个 一:简化代码,便于sql语句的书写 二:有效的禁止sql语句的注入,例如:用户名和密码,使用Prepared ...