自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(13)
  • 收藏
  • 关注

原创 [Leetcode]74(240). Search a 2D Matrix I,II

Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:Integers in each row are sorted from left to right.The first integer of each

2017-03-28 11:22:15 250

原创 [Leetcode]33(81). Search in Rotated Sorted Array I, II

题目大意:Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand.(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).You are given a target value to search

2017-03-28 05:57:59 279

原创 [Leetcode]1(167). Two Sum I, II

Two Sum IGiven an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input would have exactly one solution, and you may not us...

2017-03-25 05:55:35 214

原创 [Leetcode]14. Longest Common Prefix

题目大意:Write a function to find the longest common prefix string amongst an array of strings.分析:找到字符串数组的最长前缀。例如:{"abc","ahsja","adef"} -> "a"          {"abc","ahsja","adef","6734"}

2017-03-25 03:33:39 265

原创 [Leetcode]17. 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 telephone buttons) is given below.I...

2017-03-24 12:25:43 383

原创 [Leetcode]11. Container With Most Water

题目大意:点击打开链接分析:题目就是要在所有竖线段中选择两条,使得盛水面积最大,1.盛水面积=两端线段之间距离*两线段中高度低者;2. 如果height[left]     如果height[left] > height[right], 则右边right- -,右边向左滑动一个,计算面积,记录,与当前最大面积比较3. 最后返回所有比较后的最大面积maxResult;  

2017-03-24 04:44:53 298

原创 [leetcode]6. ZigZag Conversion

题目大意:点击打开链接分析:看起来很厉害的一道题,找到规律后理解起来就容易多了。参考了别人写的很清晰的代码,也学习到了。1. 初始化每一个小StringBuffer,一共numRows个,相当于将所有元素分成了numRows个小组    这一步很重要,初始化后每一个为空,等着向里面放元素2. int group = i % part ; 也是关键的一步,将元素划分到指定的小

2017-03-21 06:55:14 420

原创 [Leetcode]7. Reverse Integer

题目大意:Reverse digits of an integer.Example1: x = 123, return 321Example2: x = -123, return -321click to show spoilers.Note:The input is assumed to be a 32-bit signed integer. Your f

2017-03-19 11:02:56 411

原创 [leetcode]3. Longest Substring Without Repeating Characters

题目大意:Given a string, find the length of thelongest substringwithout repeating characters.Examples:Given"abcabcbb", the answer is"abc", which the length is 3.Given"bbbbb", the an

2017-03-19 09:37:08 220

原创 [Leetcode]152. Maximum Product Subarray

题目大意:Find the contiguous subarray within an array (containing at least one number) which has the largest product.For example, given the array [2,3,-2,4],the contiguous subarray [2,3] has

2017-03-16 11:06:22 205

原创 [Amazon] Reverse Words in a Stri

题目大意:Given an input string, reverse the string word by word.For example,Given s = "the sky is blue",return "blue is sky the".选这个题目写blog,是让自己认识一个必须认识的符号 "\\s+", 顺便用此题举例该符号使用方法。正则表达式

2017-03-16 06:10:22 263

原创 [Leetcode]532. K-diff Pairs in an Array

题目大意:点击打开链接public int findPairs(int[] nums, int k) { if(nums==null||nums.length==0||k<0){ return 0; } Map map=new HashMap(); for(int i:nums){ map.put(i,map.getOr

2017-03-15 05:45:02 462

原创 [Algorithm] 九章一:算法面试与代码风格

面试

2017-03-05 06:22:48 561

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除