自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 (java)leetcode-28

Implement strStr()Implement strStr().Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.解题思路:这道题还是比较简答的,就是找到字符串的子串,匹配的话就返回第一个匹配值所在的i

2017-04-10 13:31:30 588

原创 (java)leetcode-24

Swap Nodes in PairsGiven a linked list, swap every two adjacent nodes and return its head.For example,Given 1->2->3->4, you should return the list as 2->1->4->3.Your algorithm should use onl

2017-04-06 22:12:48 692

原创 (java)leetcode-27

Remove ElementGiven an array and a value, remove all instances of that value in place and return the new length.Do not allocate extra space for another array, you must do this in place with cons

2017-04-06 21:57:48 538

原创 (java)leetcode-26

Remove Duplicates from Sorted ArrayGiven a sorted array, remove the duplicates in place such that each element appear only once and return the new length.Do not allocate extra space for another

2017-04-06 21:45:54 855

原创 (java)leetcode-22

Generate ParenthesesGiven n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, given n = 3, a solution set is:[ "((()))", "(()())",

2017-04-06 20:36:14 463

原创 (java)leetcode-23

Merge k Sorted ListsMerge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.解题思路:当时看到这个最开始的想法是两两进行合并然后这样不断循环下去,但是当时想说会不会复杂度有点高就没用了,就用了一种方法说,找到所有队列中的

2017-04-03 16:12:10 395

原创 (java)leetcode-19

Remove Nth Node From End of ListGiven a linked list, remove the nth node from the end of list and return its head.For example, Given linked list: 1->2->3->4->5, and n = 2. After removing

2017-04-03 14:41:13 733

原创 (java)leetcode-21

Merge Two Sorted ListsMerge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.解题思路:就是拿两个链表组合成一个,这个还是比较简单的

2017-04-03 11:16:52 658

原创 (java)leetcode-20

Valid ParenthesesGiven a string containing just the characters'(', ')', '{', '}', '[' and']', determine if the input string is valid.The brackets must close in the correct order,"()" and "

2017-04-02 23:12:21 464

原创 (java)leetcode-17

Letter Combinations of a Phone NumberGiven a digit string, return all possible letter combinations that the number could represent.A mapping of digit to letters (just like on the telephone butto

2017-04-02 21:58:19 984

原创 (java)leetcode-16

3Sum ClosestGiven 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 wo

2017-04-02 15:57:54 217

原创 (java)leetcode-11

Container With Most WaterGiven n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at

2017-03-31 14:17:57 748

转载 (java)leetcode-10

其实这个不能说是转载吧,但是代码是别人的,所以就算是转载吧。Regular Expression MatchingImplement regular expression matching with support for'.' and '*'.'.' Matches any single character.'*' Matches zero or more of the

2017-03-29 22:15:59 821

原创 (java)leetcode-14

Longest Common PrefixWrite a function to find the longest common prefix string amongst an array of strings.解题思路:大概就是先拿第一个作为前缀去匹配第二个,更新前缀,不断循环下去直到结束。有一个点就是,可以先比较前缀跟要匹配的String的长度大小,如果前缀长度大于要

2017-03-27 13:13:59 541

原创 (java)leetcode-9

Palindrome NumberDetermine whether an integer is a palindrome. Do this without extra space.Some hints:Could negative integers be palindromes? (ie, -1)If you are thinking of converting the in

2017-03-22 21:35:27 274

原创 (java)leetcode-8

String to Integer (atoi)Implement atoi to convert a string to an integer.Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself wh

2017-03-21 13:00:15 270

原创 (java)leetcode-6

ZigZag ConversionThe string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility)P A

2017-03-20 14:41:42 398

原创 (java)leetcode-7

Reverse IntegerReverse digits of an integer.Example1: x = 123, return 321Example2: x = -123, return -321Note:The input is assumed to be a 32-bit signed integer. Your function should retu

2017-03-19 10:40:35 984

原创 (java)leetcode-5

Longest Palindromic SubstringGiven a string s, find the longest palindromic substring ins. You may assume that the maximum length of s is 1000.Example:Input : "babad"Output : "bab"Note:

2017-03-18 17:33:30 812

原创 (java)leetcode-4

Median of Two Sorted ArraysThere are two sorted arrays nums1 andnums2 of size m and n respectively.Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)

2017-03-18 10:43:23 420

原创 (java)leetcode-3

这几天又是感冒又是做项目都没时间来做题。趁今晚有空做一做。Longest Substring Without Repeating CharactersGiven a string, find the length of the longest substring without repeating characters.Examples:Given "abcabcbb",

2017-03-15 20:38:57 555

原创 (java)leetcode-2

Add Two NumbersYou are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two n

2017-03-08 09:33:43 289

原创 (java)leetcode-15

3sumGiven an array S of n integers, are there elements a, b, c in S 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

2017-03-02 11:12:14 277

原创 (java)leetcode-1

Two SumGiven 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-01 11:02:49 241

空空如也

空空如也

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

TA关注的人

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