IncredibleThings

导航

上一页 1 ··· 17 18 19 20 21 22 23 24 25 ··· 28 下一页

2016年7月27日 #

LeetCode-4Sum

摘要: Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target? Find all unique quadruplets in the array which gives the sum of target. Note: The solution se... 阅读全文

posted @ 2016-07-27 08:10 IncredibleThings 阅读(105) 评论(0) 推荐(0) 编辑

2016年7月23日 #

Leetcode-Letter Combinations of a Phone Number

摘要: Given a digit string, return all possible letter combinations that the number could represent. A mapping of digit to letters (just like on the telepho 阅读全文

posted @ 2016-07-23 00:53 IncredibleThings 阅读(128) 评论(0) 推荐(0) 编辑

2016年7月22日 #

LeetCode-3Sum Closest

摘要: Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integers. You may assume that each input would have exactl... 阅读全文

posted @ 2016-07-22 02:07 IncredibleThings 阅读(128) 评论(0) 推荐(0) 编辑

2016年7月21日 #

LeetCOde-3Sum

摘要: 我们可以先固定一个数,然后找另外两个数之和为第一个数的相反数就可以了。 阅读全文

posted @ 2016-07-21 03:10 IncredibleThings 阅读(129) 评论(0) 推荐(0) 编辑

2016年7月20日 #

LeetCode-Longest Palindromic Substring

摘要: 这道题是比较常考的题目,求回文子串,一般有两种方法。 第一种方法比较直接,实现起来比较容易理解。基本思路是对于每个子串的中心(可以是一个字符,或者是两个字符的间隙,比如串abc,中心可以是a,b,c,或者是ab的间隙,bc的间隙)往两边同时进行扫描,直到不是回文串为止。假设字符串的长度为n,那么中心 阅读全文

posted @ 2016-07-20 23:36 IncredibleThings 阅读(144) 评论(0) 推荐(0) 编辑

2016年7月19日 #

LeetCode-Guess Number Higher or Lower

摘要: We are playing the Guess Game. The game is as follows: I pick a number from 1 to n. You have to guess which number I picked. Every time you guess wrong, I'll tell you whether the number is higher o... 阅读全文

posted @ 2016-07-19 22:56 IncredibleThings 阅读(139) 评论(0) 推荐(0) 编辑

LeetCode-Intersection of Two Arrays II

摘要: Given two arrays, write a function to compute their intersection. Example: Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2, 2]. Note: Each element in the result should appear as many times as... 阅读全文

posted @ 2016-07-19 21:49 IncredibleThings 阅读(120) 评论(0) 推荐(0) 编辑

LeetCode-Intersection of Two Arrays

摘要: Given two arrays, write a function to compute their intersection. Example: Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2]. Note: Each element in the result must be unique. The result can be... 阅读全文

posted @ 2016-07-19 06:09 IncredibleThings 阅读(196) 评论(0) 推荐(0) 编辑

LeetCode-Reverse Vowels of a String

摘要: Write a function that takes a string as input and reverse only the vowels of a string. Example 1: Given s = "hello", return "holle". Example 2: Given s = "leetcode", return "leotcede". public cla... 阅读全文

posted @ 2016-07-19 05:00 IncredibleThings 阅读(112) 评论(0) 推荐(0) 编辑

LeetCode-Reverse String

摘要: Write a function that takes a string as input and returns the string reversed. Example: Given s = "hello", return "olleh". public class Solution { public String reverseString(String s) { ... 阅读全文

posted @ 2016-07-19 03:28 IncredibleThings 阅读(91) 评论(0) 推荐(0) 编辑

上一页 1 ··· 17 18 19 20 21 22 23 24 25 ··· 28 下一页