蚂蚁不在线

2018年7月25日

leetcode python 009

摘要: ##懒得自己做 ## 验证回文数字int0=63435435print(int(str(int0)[::-1])==int) 阅读全文

posted @ 2018-07-25 22:26 蚂蚁不在线 阅读(62) 评论(0) 推荐(0) 编辑

leetcode python 008

摘要: ## 字符串转化为整数## 懒得自己做int0=63435435print(int(int0)) 阅读全文

posted @ 2018-07-25 22:23 蚂蚁不在线 阅读(104) 评论(0) 推荐(0) 编辑

leetcode python 007

摘要: ## 翻转整数def evert(int0): if int0<0: flg=1 else: flg=0 e=int(str(int0)[flg:][::-1]) return e*(-1)**flgint0=-1499851571print(evert(int0)) 阅读全文

posted @ 2018-07-25 21:58 蚂蚁不在线 阅读(237) 评论(0) 推荐(0) 编辑

leetcode python 006

摘要: ## 改为z型字符串def change_to_z(s,n): ## 字符串不能生成完整的区,用空格补全 b=len(s)%(2*n-2) if b!=0: s+=' '*(n*2-2-b) a=len(s)//(2*n-2) lz=[] ## 不同的层 for i in range(n): lg= 阅读全文

posted @ 2018-07-25 21:45 蚂蚁不在线 阅读(307) 评论(0) 推荐(0) 编辑

leetcode python 005

摘要: ## 给定字符串,寻找最长回文子串## 单回文,双回文def findh(s): ## 单回文 ld,l=[],len(s) if len(s)<3: return 'too short' for i in range(1,l-1): for j in range(1,min(i+1,l-i)): 阅读全文

posted @ 2018-07-25 14:49 蚂蚁不在线 阅读(222) 评论(0) 推荐(0) 编辑

leetcode python 004

摘要: ## 已知l1,l2均为升序数组,## 在两数组l1,l2中寻找第n位数,## 两数组中位数中,前者大于后者,说明后者中位数以下的成员必定在真正中位数之下## 可以将其剔除,剔除a个元素后的两数组中寻找第n-a位数,等价于def findmid(l1,l2): m,n=len(l1),len(l2) 阅读全文

posted @ 2018-07-25 14:48 蚂蚁不在线 阅读(437) 评论(0) 推荐(0) 编辑

导航