摘要:
把只包含因子2、3和5的数称作丑数(Ugly Number)。例如6、8都是丑数,但14不是,因为它包含因子7。 习惯上我们把1当做是第一个丑数。求按从小到大的顺序的第N个丑数。 别人的代码,我的超时。 阅读全文
posted @ 2017-05-31 16:14
无惧风云
阅读(170)
评论(0)
推荐(0)
摘要:
求出1~13的整数中1出现的次数,并算出100~1300的整数中1出现的次数?为此他特别数了一下1~13中包含1的数字有1、10、11、12、13因此共出现6次,但是对于后面问题他就没辙了。ACMer希望你们帮帮他,并把问题更加普遍化,可以很快的求出任意非负整数区间中1出现的次数。 阅读全文
posted @ 2017-05-31 14:43
无惧风云
阅读(189)
评论(0)
推荐(0)
摘要:
You have a total of n coins that you want to form in a staircase shape, where every k-th row must have exactly k coins. Given n, find the total number 阅读全文
posted @ 2017-05-31 10:25
无惧风云
阅读(123)
评论(0)
推荐(0)
摘要:
Given an index k, return the kth row of the Pascal's triangle. For example, given k = 3,Return [1,3,3,1]. Note:Could you optimize your algorithm to us 阅读全文
posted @ 2017-05-31 10:13
无惧风云
阅读(147)
评论(0)
推荐(0)
浙公网安备 33010602011771号