
贪心
小·幸·运
你的所有努力最后都会回赠予你。
展开
-
LeetCode--122. Best Time to Buy and Sell Stock II
Say you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may complete as many transactions as you like (i.e., buy one ...原创 2018-05-30 15:31:58 · 229 阅读 · 0 评论 -
PAT甲级A1033 To Fill or Not to Fill (25)
With highways available, driving a car from Hangzhou to any other city is easy. But since the tank capacity of a car is limited, we have to find gas stations on the way from time to time. Different ga...原创 2018-08-22 21:48:02 · 275 阅读 · 0 评论 -
PAT甲级A1038 Recover the Smallest Number(30 分)
Given a collection of number segments, you are supposed to recover the smallest number from them. For example, given { 32, 321, 3214, 0229, 87 }, we can recover many numbers such like 32-321-3214-0229...原创 2018-08-28 21:31:08 · 197 阅读 · 0 评论 -
LeetCode--942. DI String Match
Given a string S that only contains "I" (increase) or "D" (decrease), let N = S.length. Return any permutation A of [0, 1, ..., N] such that for all i = 0, ..., N-1: If S[i] == "I", then A[i] < A...原创 2019-02-11 21:55:05 · 175 阅读 · 0 评论