![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
python
poisona1
这个作者很懒,什么都没留下…
展开
-
python3刷leetcode第165题165.compare version number
class Solution: def compareVersion(self,version1:str,version2:str) -> int: version1 = version1.split('.') version2 = version2.split('.') n = max(len(version1),len(version2)) print("这是数字1",version1) pr原创 2020-06-04 20:31:28 · 149 阅读 · 0 评论 -
python 刷leetcode第七题 7. Reverse Integer
class Solution: def reverse(self,x): # 范围-214783648~214783647 num = 0 #返回绝对整数 a = abs(x) # 假设 有个123 # a = 123 # nume = 0 # 第一次迭代的时候 #原创 2020-06-04 15:15:42 · 196 阅读 · 0 评论 -
纯小白 python刷Leetcode第一题 twoSum
class Solution: def twoSum(self, nums, target): for i in nums: # 目标的两个数分别为 i 和 j,所以i+j = 9 #从第一个i开始每个数开始找,第一个i = 2,所以要找到的j应该是7 j = target - i #7 = 9 - 2 start_index = nums.index(i)原创 2020-06-04 14:18:22 · 202 阅读 · 1 评论