
leetcode
文章平均质量分 67
HCacm
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
堆排序
排序原创 2017-10-17 18:41:07 · 320 阅读 · 0 评论 -
leetcode 22. Generate Parentheses
相关问题Discription 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:[ “((()))”, “(()())”, “(())()原创 2017-10-30 12:02:33 · 317 阅读 · 0 评论 -
leetcode 23. Merge k Sorted Lists
相关问题Discription Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.思路最小堆 该题为二路归并的变种,多路归并。使用最小堆结构在log(k)\log(k)时间复杂度内找到当前最小元素。时间复杂度:nlog(k)n\log(k) 空间复杂度原创 2017-10-30 17:06:42 · 261 阅读 · 0 评论 -
leetcode 24. Swap Nodes in Pairs
相关问题Discription 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原创 2017-10-30 19:24:40 · 230 阅读 · 0 评论 -
leetcode 25. Reverse Nodes in k-Group
相关问题24. Swap Nodes in Pairs 25. Reverse Nodes in k-GroupDiscription Given a linked list, reverse the nodes of a linked list k at a time and return its modified list.k is a positive integer and is less原创 2017-10-30 19:48:53 · 249 阅读 · 0 评论 -
leetcode 99. Recover Binary Search Tree
相关问题144. Binary Tree Preorder Traversal 94. Binary Tree Inorder Traversal 145. Binary Tree Postorder Traversal99. Recover Binary Search TreeDiscription Two elements of a binary search tree (BST) are原创 2017-10-31 10:31:34 · 371 阅读 · 0 评论 -
leetcode 97. Interleaving String
相关问题Discription Given s1, s2, s3, find whether s3 is formed by the interleaving of s1 and s2.For example, Given: s1 = “aabcc”, s2 = “dbbca”,When s3 = “aadbbcbcac”, return true. When s3 = “aadbbbacc原创 2017-10-31 14:35:05 · 297 阅读 · 1 评论 -
leetcode 144. Binary Tree Preorder Traversal
相关问题144. Binary Tree Preorder Traversal 94. Binary Tree Inorder Traversal 145. Binary Tree Postorder TraversalDiscription Given a binary tree, return the preorder traversal of its nodes’ values.For e原创 2017-10-14 15:59:17 · 268 阅读 · 0 评论 -
leetcode 94. Binary Tree Inorder Traversal
相关问题144. Binary Tree Preorder Traversal 94. Binary Tree Inorder Traversal 145. Binary Tree Postorder TraversalDiscription Given a binary tree, return the inorder traversal of its nodes’ values.For ex原创 2017-10-14 16:10:31 · 253 阅读 · 0 评论 -
leetcode 145. Binary Tree Postorder Traversal
相关问题144. Binary Tree Preorder Traversal 94. Binary Tree Inorder Traversal 145. Binary Tree Postorder TraversalDiscription Given a binary tree, return the postorder traversal of its nodes’ values.For原创 2017-10-14 16:25:39 · 310 阅读 · 0 评论 -
leetcode 11. Container With Most Water
相关问题Discription Given n non-negative integers a1,a2,...,ana_1, a_2, ..., a_n, where each represents a point at coordinate (i,ai)(i, a_i). nn vertical lines are drawn such that the two endpoints of line原创 2017-10-14 16:55:55 · 213 阅读 · 0 评论 -
leetcode 42. Trapping Rain Water
相关问题 11. Container With Most Water 42. Trapping Rain Water 407. Trapping Rain Water IIDiscription Given n non-negative integers representing an elevation map where the width of each bar is 1, compute原创 2017-10-14 19:10:40 · 268 阅读 · 0 评论 -
leetcode 15. 3Sum
相关问题1. Two Sum 15. 3SumDiscription 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: The原创 2017-10-18 21:49:37 · 274 阅读 · 0 评论 -
leetcode 1. Two Sum
Given 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-10-09 17:08:23 · 249 阅读 · 0 评论 -
leetcode 3. Longest Substring Without Repeating Characters
Discription Given a string, find the length of the longest substring without repeating characters.Examples: Given “abcabcbb”, the answer is “abc”, which the length is 3.Given “bbbbb”, the answer is “b”,原创 2017-10-09 19:22:30 · 238 阅读 · 0 评论 -
leetcode 17. Letter Combinations of a Phone Number
相关问题17. Letter Combinations of a Phone Number 77. CombinationsDiscription Given a digit string, return all possible letter combinations that the number could represent.A mapping of digit to letters (j原创 2017-10-18 22:52:17 · 206 阅读 · 0 评论 -
leetcode 454. 4Sum II
相关问题1. Two Sum 15. 3Sum 16. 3Sum Closest 18. 4Sum 454. 4Sum IIDiscription Given four lists A, B, C, D of integer values, compute how many tuples (i, j, k, l) there are such that A[i] + B[j] + C[k]原创 2017-10-27 14:40:37 · 356 阅读 · 0 评论 -
leetcode 4. Median of Two Sorted Arrays
Discription 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)).Example 1: nums1 =原创 2017-10-09 19:41:17 · 234 阅读 · 0 评论 -
leetcode 5. Longest Palindromic Substring
Discription Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000.Example:Input: “babad”Output: “bab”Note: “aba” is also a valid answer.原创 2017-10-10 22:06:01 · 211 阅读 · 0 评论 -
leetcode 46. Permutations
Discription Given 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-10-11 16:51:22 · 250 阅读 · 0 评论 -
leetcode 47. Permutations II
相关问题leetcode 46. PermutationsDiscription Given a collection of numbers that might contain duplicates, return all possible unique permutations.For example, [1,1,2] have the following unique permutation原创 2017-10-11 20:20:17 · 229 阅读 · 0 评论 -
leetcode 48. Rotate Image
Discription You are given an n x n 2D matrix representing an image.Rotate the image by 90 degrees (clockwise).Note: You have to rotate the image in-place, which means you have to modify the input 2D m原创 2017-10-12 10:33:20 · 227 阅读 · 0 评论 -
leetcode 19. Remove Nth Node From End of List
相关问题Discription Given a linked list, remove the n-th 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, t原创 2017-10-29 15:53:50 · 322 阅读 · 0 评论 -
leetcode 77. Combinations
Discription Given two integers n and k, return all possible combinations of k numbers out of 1 … n.For example, If n = 4 and k = 2, a solution is:[ [2,4], [3,4], [2,3], [1,2], [1,3],原创 2017-10-12 15:59:46 · 293 阅读 · 0 评论 -
leetcode 215. Kth Largest Element in an Array
Discription Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element.For example, Given [3,2,1,5,6,4] and k = 2, ret原创 2017-10-12 16:43:05 · 223 阅读 · 0 评论 -
leetcode 407. Trapping Rain Water II
相关问题11. Container With Most Water 42. Trapping Rain Water 407. Trapping Rain Water IIDiscription Given an m x n matrix of positive integers representing the height of each unit cell in a 2D elevation原创 2017-10-14 22:10:49 · 264 阅读 · 0 评论