![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
leetcode
文章平均质量分 60
aljjj
这个作者很懒,什么都没留下…
展开
-
[leetcode]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,原创 2014-12-17 15:11:55 · 150 阅读 · 0 评论 -
[leetcode] Longest Substring Without Repeating Characters
题目:Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters for "abcabcbb" is "abc", which the length is 3.原创 2014-12-17 14:15:04 · 1204 阅读 · 0 评论 -
[leetcode]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 enti原创 2014-12-17 14:56:28 · 196 阅读 · 0 评论 -
[leetcode]Roman to Integer
题目:Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.链接:https://oj.leetcode.com/problems/roman-to-integer/描述:把罗马数字转换成整形solut原创 2014-12-17 15:20:14 · 165 阅读 · 0 评论 -
[leetcode]Valid Parentheses
题目:Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.The brackets must close in the correct order, "()" and "()[]{}" are原创 2014-12-17 15:39:39 · 149 阅读 · 0 评论 -
[leetcode]Palindrome Number
题目:验证一个数是不是回文数链接:https://oj.leetcode.com/problems/palindrome-number/描述:每次取最高位和最低位比较是否相同,注意负数不是回文数solution by python:class Solution: # @return a boolean def isPalindrome(self, x):原创 2014-12-17 14:53:00 · 101 阅读 · 0 评论 -
[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 telephone buttons) is given below.Input:D原创 2014-12-17 15:30:16 · 229 阅读 · 0 评论 -
[leetcode]Implement strStr()
题目:Implement strStr().Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.Update (2014-11-02):The signature of the function had bee原创 2014-12-17 16:11:02 · 235 阅读 · 0 评论 -
[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:原创 2014-12-17 15:33:36 · 128 阅读 · 0 评论 -
[leetcode]Binary Tree Preorder Traversal
题目:Given a binary tree, return the preorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3}, 1 \ 2 / 3return [1,2,3].Note: Recursive原创 2015-01-08 17:27:46 · 145 阅读 · 0 评论 -
[leetcode]Binary Tree Postorder Traversal
题目:Given a binary tree, return the postorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3}, 1 \ 2 / 3return [3,2,1].Note: Recursiv原创 2015-01-08 17:32:38 · 153 阅读 · 0 评论 -
[leetcode]Reverse Nodes in k-Group
题目: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 a原创 2014-12-17 16:03:52 · 131 阅读 · 0 评论 -
[leetcode]Swap Nodes in Pairs
题目: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 s原创 2014-12-17 16:02:15 · 195 阅读 · 0 评论 -
[leetcode]Remove Nth Node From End of List
题目: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 e原创 2014-12-17 15:37:29 · 119 阅读 · 0 评论 -
[leetcode]Longest Palindromic Substring
题目: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.链接:https://oj.l原创 2014-12-17 14:28:16 · 133 阅读 · 0 评论 -
[leetcode]Reverse Integer
题目:Reverse digits of an integer.Example1: x = 123, return 321Example2: x = -123, return -321链接:https://oj.leetcode.com/problems/reverse-integer/解法:直接处理,注意溢出,leetcode加强了判题现在要处理溢出,以前的代原创 2014-12-17 14:46:27 · 207 阅读 · 0 评论 -
[leetcode]Integer to Roman
题目:Given an integer, convert it to a roman numeral.Input is guaranteed to be within the range from 1 to 3999.链接:https://oj.leetcode.com/problems/integer-to-roman/描述:把整形转化为罗马数字solut原创 2014-12-17 15:17:27 · 267 阅读 · 0 评论 -
[leetcode]Longest Common Prefix
题目:Write a function to find the longest common prefix string amongst an array of strings.链接:https://oj.leetcode.com/problems/longest-common-prefix/描述:找出字符串数组中的最长公共前缀solution by python:class So原创 2014-12-17 15:22:21 · 112 阅读 · 0 评论 -
[leetcode]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原创 2014-12-17 15:23:44 · 110 阅读 · 0 评论 -
[leetcode]ZigZag Conversion
题目: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 NA P原创 2014-12-17 14:41:35 · 129 阅读 · 0 评论 -
[leetcode]Generate Parentheses
题目:Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, given n = 3, a solution set is:"((()))", "(()())", "(())()", "()(())"原创 2014-12-17 15:42:50 · 204 阅读 · 0 评论 -
[leetcode]Remove Duplicates from Sorted Array
题目:Given 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 array, you must do this in pla原创 2014-12-17 16:06:41 · 173 阅读 · 0 评论 -
[leetcode]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 targ原创 2014-12-17 11:18:49 · 165 阅读 · 0 评论 -
[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原创 2014-12-17 15:27:34 · 242 阅读 · 0 评论 -
[leetcode]Median of Two Sorted Arrays
题目:There are two sorted arrays A and B 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)).描述:对数时间复杂度寻找两个数组中的中位数思路:实现原创 2014-12-17 11:28:58 · 171 阅读 · 0 评论 -
[leetcode]Binary Tree Inorder Traversal
题目:Given a binary tree, return the inorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3}, 1 \ 2 / 3return [1,3,2].Note: Recursive solu原创 2015-01-08 17:29:54 · 191 阅读 · 0 评论