leetcode
weixin_kite
这个作者很懒,什么都没留下…
展开
-
leetcode题解Java | 148. Sort List
题目:https://leetcode.com/problems/sort-list/?tab=DescriptionSort a linked list in O(n log n) time using constant space complexity.分析:这是一道二路归并的题目。其核心思想是把整条数链一直二分,分到只有一个元素为止,然后开始把有序的段两两归并。把一个原创 2017-02-22 19:37:29 · 440 阅读 · 0 评论 -
leetcode题解c++ | 25. Reverse Nodes in k-Group
题目:https://leetcode.com/problems/reverse-nodes-in-k-group/#/descriptionGiven a linked list, reverse the nodes of a linked list k at a time and return its modified list.k is a positive intege原创 2017-05-19 18:45:53 · 528 阅读 · 0 评论 -
leetcode题解c++ | 37. Sudoku Solver
题目:https://leetcode.com/problems/sudoku-solver/#/descriptionWrite a program to solve a Sudoku puzzle by filling the empty cells.Empty cells are indicated by the character '.'.You may ass原创 2017-05-31 12:15:33 · 518 阅读 · 0 评论 -
leetcode题解c++ | 76. Minimum Window Substring
题目:https://leetcode.com/problems/minimum-window-substring/#/descriptionGiven a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n)原创 2017-05-27 12:31:31 · 487 阅读 · 0 评论 -
leetcode题解c++ | 23. Merge k Sorted Lists
题目:https://leetcode.com/problems/merge-k-sorted-lists/#/descriptionMerge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.分析:合并k个有序链表,其本质就是合并2个有序原创 2017-05-08 11:41:28 · 378 阅读 · 0 评论 -
leetcode题解c++ | 72. Edit Distance
题目:https://leetcode.com/problems/edit-distance/#/descriptionGiven two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each operation is counted as 1原创 2017-05-15 12:02:05 · 280 阅读 · 0 评论 -
leetcode题解Java | 11. Container With Most Water
题目:https://leetcode.com/problems/container-with-most-water/#/descriptionGiven n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines a原创 2017-04-21 16:32:09 · 215 阅读 · 0 评论 -
leetcode题解c++ | 10. Regular Expression Matching
题目:https://leetcode.com/problems/regular-expression-matching/#/descriptionImplement regular expression matching with support for '.' and '*'.'.' Matches any single character.'*' Matches zero原创 2017-05-02 12:06:44 · 384 阅读 · 0 评论 -
leetcode题解Java | 421. Maximum XOR of Two Numbers in an Array
题目:https://leetcode.com/problems/maximum-xor-of-two-numbers-in-an-array/#/descriptionGiven a non-empty array of numbers, a0, a1, a2, … , an-1, where 0 ≤ ai < 231.Find the maximum result原创 2017-04-15 12:24:01 · 491 阅读 · 0 评论 -
leetcode题解Java | 4. Median of Two Sorted Arrays
题目:https://leetcode.com/problems/median-of-two-sorted-arrays/#/descriptionThere are two sorted arrays nums1 and nums2 of size m and n respectively.Find the median of the two sorted arrays. T原创 2017-04-01 17:11:07 · 534 阅读 · 0 评论 -
leetcode题解Java | 210. Course Schedule II
题目:https://leetcode.com/problems/course-schedule-ii/#/descriptionThere are a total of n courses you have to take, labeled from 0 to n - 1.Some courses may have prerequisites, for example t原创 2017-03-24 18:48:36 · 529 阅读 · 0 评论 -
leetcode题解Java | 208. Implement Trie (Prefix Tree)
题目:https://leetcode.com/problems/implement-trie-prefix-tree/#/descriptionImplement a trie with insert, search, and startsWith methods.Note:You may assume that all inputs are consist of l原创 2017-04-09 11:28:51 · 430 阅读 · 0 评论 -
leetcode题解Java | 310. Minimum Height Trees
题目:https://leetcode.com/problems/minimum-height-trees/#/descriptionFor a undirected graph with tree characteristics, we can choose any node as the root. The result graph is then a rooted tree. A原创 2017-03-19 13:38:03 · 412 阅读 · 0 评论 -
leetcode题解Java | 491. Increasing Subsequences
题目:Given an integer array, your task is to find all the different possible increasing subsequences of the given array, and the length of an increasing subsequence should be at least 2 .Examp原创 2017-03-10 20:18:36 · 618 阅读 · 0 评论 -
leetcode题解c++ | 241. Different Ways to Add Parentheses
题目:Given a string of numbers and operators, return all possible results from computing all the different possible ways to group numbers and operators. The valid operators are +, - and *.Exam原创 2017-03-02 17:20:38 · 443 阅读 · 0 评论 -
leetcode题解c++ | 74. Search a 2D Matrix
题目:https://leetcode.com/problems/search-a-2d-matrix/#/descriptionWrite an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:Integ原创 2017-06-21 20:22:21 · 279 阅读 · 0 评论