算法分析与设计
文章平均质量分 68
_风铃
这个作者很懒,什么都没留下…
展开
-
207. Course Schedule
Description: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 course 1, whic原创 2017-09-24 14:05:55 · 152 阅读 · 0 评论 -
338. Counting Bits
Description: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-12-24 20:17:17 · 133 阅读 · 0 评论 -
198. House Robber
Description: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 of them is t原创 2018-01-21 18:53:06 · 108 阅读 · 0 评论 -
213. House Robber II
Description:Note: This is an extension of House Robber.After robbing those houses on that street, the thief has found himself a new place for his thievery so that he will not get too much at原创 2018-01-21 19:30:12 · 119 阅读 · 0 评论 -
42. Trapping Rain Water
Description:Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining.For example, Given [0,1,0,原创 2018-01-21 21:03:46 · 145 阅读 · 0 评论 -
330. Patching Array
Description:Given a sorted positive integer array nums and an integer n, add/patch elements to the array such that any number in range [1, n]inclusive can be formed by the sum of some el原创 2018-01-21 21:58:43 · 253 阅读 · 0 评论 -
392. Is Subsequence
Description:Given a string s and a string t, check if s is subsequence of t.You may assume that there is only lower case English letters in both s and t. t is potentially a very long (length原创 2017-10-31 11:19:14 · 159 阅读 · 0 评论 -
11. Container With Most Water
Description: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)原创 2017-12-24 18:19:50 · 137 阅读 · 0 评论 -
684. Redundant Connection
Description:In this problem, a tree is an undirected graph that is connected and has no cycles.The given input is a graph that started as a tree with N nodes (with distinct values 1, 2, ..., N原创 2017-10-15 23:15:35 · 182 阅读 · 0 评论 -
139. Word Break
Description:Given a non-empty string s and a dictionary wordDict containing a list of non-empty words, determine if s can be segmented into a space-separated sequence of one or more dictionary原创 2017-11-22 20:04:21 · 158 阅读 · 0 评论 -
64. Minimum Path Sum
Description:Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path.Note: You can only move either原创 2017-12-10 14:28:53 · 109 阅读 · 0 评论 -
63. Unique Paths II
Description:Follow up for "Unique Paths":Now consider if some obstacles are added to the grids. How many unique paths would there be?An obstacle and empty space is marked as 1 and 0 respectively原创 2017-11-29 11:10:56 · 114 阅读 · 0 评论 -
22. 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:[ "((()))", "(()())", "(())()", "()((原创 2017-09-10 20:29:16 · 115 阅读 · 0 评论 -
32. Longest Valid Parentheses
Description:Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring.For "(()", the longest valid parentheses sub原创 2017-09-17 00:34:07 · 135 阅读 · 0 评论 -
210. Course Schedule II
Description: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 course 1, whic原创 2017-09-25 23:05:31 · 184 阅读 · 0 评论 -
98. Validate Binary Search Tree
Description:Given a binary tree, determine if it is a valid binary search tree (BST).Assume a BST is defined as follows:The left subtree of a node contains only nodes with keys less than原创 2017-10-06 01:14:32 · 217 阅读 · 0 评论 -
406. Queue Reconstruction by Height
Descriptionheight of the person and k is the number of people in front of this person who have a height greater than or equal to h. Write an algorithm to reconstruct the queue.Note:The n原创 2017-10-22 15:24:06 · 159 阅读 · 0 评论 -
62. Unique Paths
Description: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 robot is tryi原创 2017-11-09 14:37:55 · 122 阅读 · 0 评论 -
300. Longest Increasing Subsequence
Description:Given an unsorted array of integers, find the length of longest increasing subsequence.For example,Given [10, 9, 2, 5, 3, 7, 101, 18],The longest increasing subsequence is [2原创 2017-11-14 12:05:19 · 127 阅读 · 0 评论 -
621. Task Scheduler
Description:Given a char array representing tasks CPU need to do. It contains capital letters A to Z where different letters represent different tasks.Tasks could be done without original order.原创 2017-11-05 21:22:50 · 116 阅读 · 0 评论 -
NP-8.8
8.8. In the EXACT 4 SAT 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-12-31 20:32:38 · 140 阅读 · 0 评论