- 博客(17)
- 收藏
- 关注
原创 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
250
原创 证明EXACT 4SAT问题为NP-complete
题目:In the EXACT 4SAT problem, the input is a set of clauses, each of which is a disjunction of exactly four literals, and such that each variable occurs at most once in each clause. The goal is to
2017-06-08 10:56:06
420
原创 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
490
原创 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
462
原创 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
516
原创 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
267
原创 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
354
原创 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
374
原创 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
184
原创 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
460
原创 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
421
原创 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
506
原创 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
523
原创 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
365
原创 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
592
原创 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
409
原创 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
407
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人