
刷题
Geek Fly
这个作者很懒,什么都没留下…
展开
-
[LeetCode] 18.四数之和 最优解@Python
题目Given an array nums of n integers and an integer target, are there elements a, b, c, and d in nums such that a + b + c + d = target? Find all unique quadruplets in the array which gives the sum of ...原创 2019-02-15 10:24:26 · 511 阅读 · 0 评论 -
[leetcode] 利用Python及Trie树实现 [14.最长公共前缀]
原题编写一个函数来查找字符串数组中的最长公共前缀。如果不存在公共前缀,返回空字符串 “”。示例 1:输入: [“flower”,“flow”,“flight”]输出: “fl”示例 2:输入: [“dog”,“racecar”,“car”]输出: “”解释: 输入不存在公共前缀。利用Trie树实现class TrieNode(object):# 利用Python定义...原创 2019-02-12 10:41:07 · 520 阅读 · 0 评论 -
[LeetCode] 15.三数之和 @Python
题目Given an array nums of n integers, are there elements a, b, c in nums such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.Note:The solution set must not con...原创 2019-02-13 09:25:46 · 288 阅读 · 0 评论 -
[LeetCode] 16.最接近的三数之和 最优解@Python
题目Given an array nums of n integers and an integer target, find three integers in nums such that the sum is closest to target. Return the sum of the three integers. You may assume that each input wou...原创 2019-02-13 13:24:08 · 818 阅读 · 0 评论