【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 ...
随机推荐
- sql except 用法,找两个表中非共同拥有的
;with tt as (select a.id as id from [dbo].[1234] a where a.id not in (select a.ProtocolID from Proto ...
- PTPX中的clock tree与LP design
PTPX在加入CPF/UPF这样的文件后,可以分析multi-voltage,power-gating这样的设计. 针对某个power rail的cell,PTPX支持进行annotate. set_ ...
- SSO系统的分析与架构
随着公司子系统越来越多,一直以来使用ucenter的同步登录方式的性能以及效率问题显得越来越大,重新构建一个SSO系统显得势在必行. 通过google搜索关于SSO单点登录文章,发现以下文章关于新浪微 ...
- RobotFramework 安装配置(一)
服务器接口的测试框架的选择,最后选中了 RobotFramework ,原因一:能有效的管理测试用例,,支持批量执行,能实现关键字驱动或者数据驱动.原因二:支持测试人员可以使用Python和java创 ...
- Inside TSQL Querying - Chapter 3. Query Tuning
Tuning Methodology When dealing with performance problems, database professionals tend to focus on t ...
- an'gularjs 环境搭建之NodeJS、NPM安装配置步骤(windows版本)
NodeJS.NPM安装配置步骤(windows版本) :http://xiaoyaojones.blog.163.com/blog/static/28370125201351501113581/ ...
- JVM总结
1. 内存分布: 1). 程序计数器(Program Counter Register)是一块较小的内存空间,它的作用可以看做是当前线程所执行的字节码的行号指示器.线程私有.如果线程正在执行的是一个J ...
- 在路由器 RT-AC68U 安装迅雷远程过程
赶紧记录下,省得时间久了忘记. 步骤如下: 1.下载迅雷远程的 Linux 组件: http://pan.baidu.com/s/1jGqYPnw . 解压缩. 2.ssh 登录au68u 路由器 ...
- 如何查看和停止Linux启动的服务
1. 查看Linux启动的服务chkconfig --list 查询出所有当前运行的服务chkconfig --list atd 查询atd服务的当前状态 2.停止所有服务并且在下次系统启动时不再启 ...
- 内容与Tag
由于要满足精准推送内容的需求, 我们需要将车辆型号与推送内容挂钩, 方法是, 在现有的基础上, 把所有车型, 打上Tag, 目前先打上国籍跟厂商. 在现有的VEHICLE表的基础上, 增加2个colu ...