
算法分析与设计作业
文章平均质量分 75
lizhb5
这个作者很懒,什么都没留下…
展开
-
hello world
#include using namespace std;int main(){ cout<<"hello world"<<endl<<endl; return 0;}原创 2017-02-21 23:27:18 · 506 阅读 · 0 评论 -
473. Matchsticks to Square
题目:Remember the story of Little Match Girl? By now, you know exactly what matchsticks the little match girl has, please find out a way you can make one square by using up all those matchsticks. You原创 2017-06-22 23:38:16 · 261 阅读 · 0 评论 -
124. Binary Tree Maximum Path Sum&145.Binary Tree Postorder Traversal
题目:Given a binary tree, find the maximum path sum.For this problem, a path is defined as any sequence of nodes from some starting node to any node in the tree along the parent-child connections. T原创 2017-06-08 16:40:19 · 232 阅读 · 0 评论 -
336. Palindrome Pairs
题目:Given a list of unique words, find all pairs of distinct indices (i, j) in the given list, so that the concatenation of the two words, i.e. words[i] + words[j] is a palindrome.给定一个序列包含若干个不重原创 2017-06-01 22:54:15 · 239 阅读 · 0 评论 -
poj 3281 Dining
题目:DescriptionCows are such finicky eaters. Each cow has a preference for certain foods and drinks, and she will consume no others.Farmer John has cooked fabulous meals for his cows, but he fo原创 2017-05-19 09:39:27 · 148 阅读 · 0 评论 -
446. Arithmetic Slices II - Subsequence
题目:A sequence of numbers is called arithmetic if it consists of at least three elements and if the difference between any two consecutive elements is the same.A zero-indexed array A consisting of N原创 2017-04-27 19:56:59 · 282 阅读 · 0 评论 -
51. N-Queens
题目:The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other.Given an integer n, return all distinct solutions to the n-queens puz原创 2017-05-26 10:16:21 · 414 阅读 · 0 评论 -
hdoj 1532 Drainage Ditches
题目:Every time it rains on Farmer John's fields, a pond forms over Bessie's favorite clover patch. This means that the clover is covered by water for awhile and takes quite a long time to regrow. Thus,原创 2017-05-04 18:15:43 · 337 阅读 · 0 评论 -
207. Course Schedule&576. Out of Boundary Paths
题目: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, which is expressed原创 2017-05-11 19:28:08 · 216 阅读 · 0 评论 -
552. Student Attendance Record II
题目:Given a positive integer n, return the number of all possible attendance records with length n, which will be regarded as rewardable. The answer may be very large, return it after mod 109 + 7.原创 2017-04-20 16:24:50 · 1128 阅读 · 0 评论 -
403. Frog Jump
题目:A frog is crossing a river. The river is divided into x units and at each unit there may or may not exist a stone. The frog can jump on a stone, but it must not jump into the water.Given a li原创 2017-04-06 15:59:45 · 277 阅读 · 0 评论 -
546. Remove Boxes
题目:Given several boxes with different colors represented by different positive numbers. You may experience several rounds to remove boxes until there is no box left. Each time you can choose some co原创 2017-04-13 19:56:39 · 1057 阅读 · 0 评论 -
407. Trapping Rain Water II
题目:Given an m x n matrix of positive integers representing the height of each unit cell in a 2D elevation map, compute the volume of water it is able to trap after raining.给定一个m x n的矩阵,表示一个2维的地图原创 2017-03-16 16:17:41 · 318 阅读 · 0 评论 -
330. Patching Array
题目: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 elements in the arr原创 2017-03-23 19:59:51 · 277 阅读 · 0 评论 -
312. Burst Balloons
题目:Given n balloons, indexed from 0 to n-1. Each balloon is painted with a number on it represented by array nums. You are asked to burst all the balloons. If the you burst balloon i you will原创 2017-03-30 17:27:00 · 230 阅读 · 0 评论 -
329. Longest Increasing Path in a Matrix
题目:Given an integer matrix, find the length of the longest increasing path.From each cell, you can either move to four directions: left, right, up or down. You may NOT move diagonally or move outs原创 2017-03-09 18:12:21 · 169 阅读 · 0 评论 -
4. Median of Two Sorted Arrays
题目: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)).有两个排好序的数组nums1和nums2,原创 2017-03-02 19:25:42 · 216 阅读 · 0 评论 -
23. Merge k Sorted Lists
题目:Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.合并K个已排序的链表,并将排序结果返回,分析和描述复杂性。 一看到这道题,由于K个链表已经是排好序的,最简单的做法就是每次找出K个链表里最小的那个元素,放入新的链表中。每次选择一原创 2017-02-23 17:17:16 · 332 阅读 · 0 评论 -
Sicily 1176. Two Ends
题目:DescriptionIn the two-player game "Two Ends", an even number of cards is laid out in a row. On each card, face up, is written a positive integer. Players take turns removing a card from either原创 2017-06-15 10:28:38 · 289 阅读 · 0 评论