【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 ...
随机推荐
- 12.了解或熟悉 C, C++, .NET
挂起,暂不了解,不过C++略懂,.net虽不懂但是做过实际项目,有能力担当
- 夺命雷公狗---微信开发57----微网站之jquery_mobile之入门案例
这节课我们主要用到到jquery_mobile来实现一个点电影播放网站 jquery_mobile(简称JQM)其实就是基于jquery开发出来的一套移动端框架,适应移动用户端市场对浏览与体验从而进一 ...
- fault coverage enhancement
在pseudo-random test中,由于random pattern resistant的特性,fault coverage不是sufficient的, 所以会有一些办法来进行coverage的 ...
- Python 入門語法和類型(转载学习)
http://www.cnblogs.com/mcdou/archive/2011/08/02/2125016.html Python的设计目标之一是让源代码具备高度的可读性.它设计时尽量使用其它语言 ...
- [OrangePi] Installation on internal EMMC
Install the image on SD Card as described above Boot your Orange PI board from SD Card Run: sudo ins ...
- java.io.DataInput接口和java.io.DataOutput接口详解
public interface DataInput DataInput 接口用于从二进制流中读取字节,并重构所有 Java 基本类型数据.同时还提供根据 UTF-8 修改版格式的数据重构 Strin ...
- Openstack的计算节点的nova-network异常中止及实例无法删除排错过程
在预生产环境(172.17.46.2)发现无法删除实例,可以对实例做暂停,恢复操作. 查询原因发现计算节点的nova-network异常 [root@node-12 ~]# /etc/init.d/o ...
- laravel队列
三种情况: queue:work 默认只执行一次队列请求, 当请求执行完成后就终止; queue:listen 监听队列请求, 只要运行着, 就能一直接受请求, 除非手动终止; queue:work ...
- pstack使用和原理【转】
转自:http://www.cnblogs.com/mumuxinfei/p/4366708.html 前言: 最近小组在组织<<深入剖析Nginx>>的读书会, 里面作者提到 ...
- 【Pro ASP.NET MVC 3 Framework】.学习笔记.12.ASP.NET MVC3的细节:URLs,Routing和Areas
Adam Applied ASP.NET 4 in Context 1 介绍Routing系统 在引入MVC之前,ASP.NET假定被请求的URLs和服务器硬盘上的文件之间有着直接关系.服务器的任务是 ...