
LeetCode
duoduozhengqian
当你的才华还撑不起你的野心的时候,你就应该静下心来学习;当你的能力还驾驭不了你的目标时,就应该沉下心来,历练;梦想,不是浮躁,而是沉淀和积累,只有拼出来的美丽,没有等出来的辉煌,机会永远是留给最渴望的那个人。
展开
-
Python-实现杨辉三角(递归)
def print_yanghui(n:int): ''' 输入n,打印杨辉三角 :param n: :return: ''' if not isinstance(n,int):return False if n < 1:return False if n == 1: print([1]) return [1] elif n == 2: print_yanghui(1) .原创 2020-06-01 23:47:15 · 2873 阅读 · 0 评论 -
Python-两数相加
class Node: def __init__(self, data): self.data= data self.next = None class Solution: def addTowNumbers(self, l1: Node, l2: Node) ->Node: prenode = Node(0) ...原创 2020-02-29 21:28:15 · 483 阅读 · 0 评论 -
Python-两数之和
题目描述 给定一个整数数组 nums和一个目标值 target,请你在该数组中找出和为目标值的那两个整数,并返回他们的数组下标。 Python解法 解题思路: 1.循环遍历数组中的每个值num,用目标值target减去num得到另一个值another_num 2.判断another_num是否存在于hashmap字典 如another_num不存在于hashmap字典中,将nu...原创 2020-02-25 23:36:36 · 1165 阅读 · 0 评论