
LeetCode
ScratKong
劝君惜取少年时
展开
-
7. 反转整数
Python实现: class Solution(object): def reverse(self, x): """ :type x: int :rtype: int """ i = 0 str1=str(x) stack = [] fu = False ...原创 2018-09-05 21:13:57 · 157 阅读 · 0 评论 -
Python 9.回文数
回文数Python实现 class Solution(object): def isPalindrome(self, x): """ :type x: int :rtype: bool """ temp = str(x)[::-1] if(temp == str(x)): ...原创 2018-09-05 22:06:25 · 310 阅读 · 0 评论 -
求两个list的交集,并集,差集。
1. 获取两个list 的交集 1 2 3 4 5 6 7 8 9 #方法一: a=[2,3,4,5] b=[2,5,8] tmp = [val for val in a if val in b] print tmp #[2, 5] ...转载 2018-11-08 21:15:13 · 610 阅读 · 0 评论