![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
LeetCode
ithouse
这个作者很懒,什么都没留下…
展开
-
5.Longest Palindromic Substring(59.30%)
题目:Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists one unique longest palindromic substring.个人理解:求给定字符串的最长回文。 我首先想到原创 2016-01-09 19:18:09 · 386 阅读 · 0 评论 -
4.Median of Two Sorted Arrays(13.12%)
题目:There are two sorted arrays nums1 and nums2 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)).个人理解:给你两个已经排列好顺序的数组,求这两个数组的原创 2016-01-08 00:54:06 · 449 阅读 · 0 评论 -
3.Longest Substring Without Repeating Characters(7.66%)
刚开始的时候贪图便利,用Java自带的字符串方法进行操作,结果超时了:public class Solution { public int lengthOfLongestSubstring(String s) { int inputLength = s.length(); int longestLength = 0; for (int i = 0原创 2016-01-06 20:10:35 · 419 阅读 · 0 评论 -
1.Two Sum
题目: Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the two numbers such that they add up to the target, whe转载 2016-01-05 16:40:17 · 410 阅读 · 0 评论 -
2. Add Two Numbers官方通过版本(8.46%)
public class AddTwoNumbers { public ListNode addTwoNumbers(ListNode l1, ListNode l2) { ListNode sumNumbers = new ListNode(0); // 进位 int forward = 0; // 遍历过程进行节点添加,开始的时候原创 2016-01-05 15:58:51 · 375 阅读 · 0 评论 -
Add Two Numbers
题目: You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a原创 2016-01-03 14:39:22 · 382 阅读 · 0 评论 -
24. Swap Nodes in Pairs(6.30%)
题目:Given 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 only constant space. You may原创 2016-09-01 10:02:58 · 344 阅读 · 0 评论 -
25. Reverse Nodes in k-Group(23.53%)
Given a linked list, reverse the nodes of a linked list k at a time and return its modified list.If the number of nodes is not a multiple of k then left-out nodes in the end should remain as it is.You原创 2016-09-02 10:55:56 · 322 阅读 · 0 评论 -
11. Container With Most Water
Given 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 (i, ai) and (i, 0). Find two lin转载 2016-01-21 10:36:23 · 366 阅读 · 0 评论 -
14. Longest Common Prefix(28.4%)
题目:Write a function to find the longest common prefix string amongst an array of strings. 解释:求输入字符串数组中最长的相同前缀public class Solution { public String longestCommonPrefix(String[] strs) { int原创 2016-01-21 11:22:30 · 373 阅读 · 0 评论 -
15. 3Sum
Given 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: Elements in a triplet (a,b,c) must be i转载 2016-01-22 20:18:18 · 423 阅读 · 0 评论 -
7.Reverse Integer(16.45%)
题目:Reverse digits of an integer.Example1: x = 123, return 321 Example2: x = -123, return -321理解:将输入的整数反向值输出,需要注意一点就是负号和反向之后值可能会超过int最大值的情况。public class Solution { public int reverse(int x) {原创 2016-01-13 15:41:12 · 423 阅读 · 0 评论 -
6.ZigZag Conversion(93.10%)
题目:The 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 H N A P L S I I原创 2016-01-12 11:28:40 · 441 阅读 · 0 评论 -
19.Remove Nth Node From End of List(7.54%)
Given 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 the second node from the end, the linked list be原创 2016-05-04 21:57:57 · 429 阅读 · 0 评论 -
18. 4Sum(35.07%)
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: Elements in a quad转载 2016-04-08 11:17:11 · 408 阅读 · 0 评论 -
16. 3Sum Closest(47.2%)
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 exactly原创 2016-01-27 19:58:30 · 431 阅读 · 0 评论 -
10. Regular Expression Matching
Implement regular expression matching with support for ‘.’ and ‘*’.‘.’ Matches any single character. ‘*’ Matches zero or more of the preceding element.The matching should cover the entire input string转载 2016-01-20 09:51:36 · 529 阅读 · 0 评论 -
9. Palindrome Number(21.01%)
题目:Determine 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 integer to string, note原创 2016-01-14 10:14:08 · 345 阅读 · 0 评论 -
17. Letter Combinations of a Phone Number(46.02%)
题目 :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. Input:Digit strin原创 2016-04-06 11:19:49 · 483 阅读 · 0 评论 -
8. String to Integer (atoi)(8.46%)
题目: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 what are the possible input case原创 2016-01-13 18:05:46 · 376 阅读 · 0 评论