![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
leetcode学习
clover猪猪
没有最好,只有更好
展开
-
leetcode练习10:
解析:解法1:转换为字符串解法2:用数学计算反转class Solution(object): def isPalindrome(self, x): """ :type x: int :rtype: bool """ xx = x if x < 0: ...原创 2020-02-12 19:39:36 · 202 阅读 · 0 评论 -
leetcode练习5:最长回文子串
题目:思考:1、偶数对称子串和奇数对称子串2、如何记录其中的最大值class Solution(object): def longestPalindrome(self, s): """ :type s: str :rtype: str """ max_l = 0 res =...原创 2020-02-08 11:34:52 · 172 阅读 · 0 评论 -
leetcode练习2:两数相加
题目二:解答:1、判断链表的长度2、如何增加节点(调用类)3、进位问题,如果进位的下一个节点为空,则必须新添加一个节点# Definition for singly-linked list.# class ListNode(object):# def __init__(self, x):# self.val = x# ...原创 2020-02-04 19:53:01 · 204 阅读 · 0 评论 -
leetcode刷题:1、两数之和
解题: 使用语言:python 解法一: class Solution(object): def twoSum(self, nums, target): """ :type nums: List[int] :type target: int :rtype: List[i...原创 2020-02-03 21:15:12 · 135 阅读 · 0 评论