- 博客(17)
- 收藏
- 关注
原创 8.3 Prove that STINGY SAT is NP-complete.
8.3 STINGY SAT is the following problem: given a set of clauses (each a disjunction of literals) and an integer k, find a satisfying assignment in which at most k variables are true, if such an assig
2017-07-14 14:43:55
684
原创 LeetCode_338、357两题(动态规划)
338. Counting Bits原题: Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1’s in their binary representation and return them as an array.Examp
2017-06-11 21:14:45
428
原创 LeetCode_2、6两题
LeetCode_2. Add Two Numbers 原题: You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit.
2017-06-04 21:22:33
197
原创 LeetCode_70、300、303三题(动态规划)
LeetCode_70. Climbing Stairs(基础题) 原题:You are climbing a stair case. It takes n steps to reach to the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the t
2017-05-29 23:02:09
270
原创 LeetCode_32、53两题(动态规划)
LeetCode_32. Longest Valid Parentheses 原题: Given a string containing just the characters ‘(’ and ‘)’, find the length of the longest valid (well-formed) parentheses substring. For “(()”, the longest
2017-05-21 22:19:20
403
原创 LeetCode_91、120两题(动态规划)
LeetCode_91. Decode Ways 原题: A message containing letters from A-Z is being encoded to numbers using the following mapping: ‘A’ -> 1 ‘B’ -> 2 … ‘Z’ -> 26Given an encoded message containing digits,
2017-05-13 15:30:54
282
原创 LeetCode_62、63、64三题(动态规划)
LeetCode_62. Unique Paths原题: A robot is located at the top-left corner of a m x n grid (marked ‘Start’ in the diagram below). The robot can only move either down or right at any point in time. The ro
2017-05-06 23:38:06
262
原创 LeetCode_3、5两题(substring问题)
LeetCode_3. Longest Substring Without Repeating Characters原题: Given a string, find the length of the longest substring without repeating characters.Examples:Given “abcabcbb”, the answer is “abc”, whic
2017-05-01 22:56:06
477
原创 LeetCode_198、213、222三题
LeetCode_198. House Robber原题: You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each
2017-04-23 15:48:35
389
原创 LeetCode_452. Minimum Number of Arrows to Burst Balloons
LeetCode_452.Minimum Number of Arrows to Burst Balloons 原题:There are a number of spherical balloons spread in two-dimensional space. For each balloon, provided input is the start and end coordinates o
2017-04-17 11:37:30
186
原创 LeetCode_19、100两题
LeetCode 19. 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 re
2017-04-09 20:45:39
198
原创 LeetCode_104、121、204三题
LeetCode104原题: Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.题意就是求一棵数的深度,很简单利用递归就可以很快求出来
2017-03-30 17:46:38
247
原创 LeetCode_199. Binary Tree Right Side View
LeetCode_199. Binary Tree Right Side View 原题:Given a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered from top to bottom.For example:G
2017-03-27 15:26:14
254
原创 LeetCode207. Course Schedule
题目来源:LeetCode207. Course Schedule原题:There are a total of n courses you have to take, labeled from 0 to n - 1.Some courses may have prerequisites, for example to take course 0 you have to first take cou
2017-03-19 14:53:33
194
原创 LeetCode--23. Merge k Sorted Lists
题目来源LeetCode.23 Merge k Sorted Lists 题意:将多个已经排好序的链表合并成一个排好序的链表主要的思想就是课堂上所学的Divide and Conquer,将大问题分成若干个小问题。在这里可以将链表不断两两合并,最后形成的就是一个排好序的总的链表。代码段如下:/** * Definition for singly-linked list. * struct Li
2017-03-12 18:36:58
185
原创 LeetCode--73.Subsets
来源:LeetCode 73.Subsets 原题:Given a set of distinct integers, nums, return all possible subsets.Note: The solution set must not contain duplicate subsets. For example, If nums = [1,2,3], a
2017-03-04 20:43:20
170
原创 LeetCode503《Next Greater Element II》栈的应用
《Next Greater Element II》----栈的应用 题目如下: Given a circular array (the next element of the last element is the first element of the array), print the Next Greater Number for every element. The Next Great
2017-02-24 23:11:48
354
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人