-
Min-Cost-Climbing-Stairs
Jan 18, 2018
第87天。 今天的题目是Min Cost Climbing Stairs: On a staircase, the i-th step has some non-negative cost cost[i] assigned (0 indexed). Once you pay the cost, you can either climb one or two steps. You need to find minimum cost to reach the top of the floor, and you can either start from the…
-
Count-Numbers-with-Unique-Digits
Dec 06, 2017
第70天。 今天的题目是Count Numbers with Unique Digits: Given a non-negative integer n, count all numbers with unique digits, x, where 0 ≤ x < 10^n. Example: Given n = 2, return 91. (The answer should be the total numbers in the range of 0 ≤ x < 100, excluding [11,22,33,44,55,66,77,88,99]) 先解释一下题目…
-
Counting Bits
Nov 23, 2017
第57天。 今天的题目是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. Example: For num = 5 you should return [0,1,1,2,1,2]. Follow up: It is very easy to…
-
Perfect Squares
Nov 20, 2017
第54天。 今天的题目是Perfect-Squares: Given a positive integer n, find the least number of perfect square numbers (for example, 1, 4, 9, 16, …) which sum to n. For example, given n = 12, return 3 because 12 = 4 + 4 + 4; given n =…
-
Maximal-Square
Nov 16, 2017
第50天。 恍恍惚惚,就50天了。 今天的题目是Maximal Square: Given a 2D binary matrix filled with 0’s and 1’s, find the largest square containing only 1’s and return its area. For example, given the following matrix: 1 0 1 0 0 1 0 1 1 1 1 1 1…
-
Partition to K Equal Sum Subsets
Oct 29, 2017
第35天。 又一次一个早上没做出来,难道要跪在DP上了吗? 今天的题目是Partition to K Equal Sum Subsets: Given an array of integers nums and a positive integer k, find whether it’s possible to divide this array into k non-empty…
-
Best Time to Buy and Sell Stock with Transaction Fee
Oct 28, 2017
第34天。 今天又没做出来,sad,同样是一道DP的题目: Your are given an array of integers prices, for which the i-th element is the price of a given stock on day i; and a non-negative integer fee representing a transaction fee. You may complete as many transactions as you like, but…