转自:https://developers.google.com/wallet/instant-buy/android/tutorialThis tutorial guides you through integrating Instant Buy into a purchase flow, in ...
分类:
移动开发 时间:
2014-09-12 11:37:43
阅读次数:
412
题意:有m个人(拿50元)和n个人(拿100元)去买票,售票厅刚开始没有,问最后所有人都能够买到的方式的种类数。
这道题也是经典的卡特兰数类型题。
我们可以将他们看做是火车进出站,但是由于人是不同的,所以最后还要乘上m!*n!
最后的数学表达是就是(C(m+n,n)-C(m+n, m+1))*m!*n!=》 结果为 (m!*n!)*(m+1-n)/(m+1)
注:m
代码:
impor...
分类:
其他好文 时间:
2014-09-11 23:52:42
阅读次数:
317
仅提供个人的一种解题思路,未必是最优,仅供各位参考!
/**
*
*
* ClassName SolutionBestTimeToBuyAndSellStock
*
*
* Description Say you have an array for which the ith element is the price of a given stock on day i....
分类:
其他好文 时间:
2014-09-11 22:28:42
阅读次数:
235
Description
World Wide Networks (WWN) is a leading company that operates large telecommunication networks. WWN would like to setup a new network in Borduria, a nice country that recently managed to...
分类:
其他好文 时间:
2014-09-10 10:54:20
阅读次数:
253
[leetcode]Best Time to Buy and Sell Stock III...
分类:
其他好文 时间:
2014-09-09 13:31:08
阅读次数:
128
[leetcode]Best Time to Buy and Sell Stock...
分类:
其他好文 时间:
2014-09-09 13:30:58
阅读次数:
202
[leetcode]Best Time to Buy and Sell Stock II...
分类:
其他好文 时间:
2014-09-09 13:30:48
阅读次数:
121
Best Time to Buy and Sell Stock
Say you have an array for which the ith element is the price of a given stock on day i.
If you were only permitted to complete at most one transaction (ie,...
分类:
其他好文 时间:
2014-09-08 09:39:06
阅读次数:
312
1 public class Solution { 2 public int maxProfit(int[] prices) { 3 if (prices.length prices[i]) buyPrices = prices[i];11 }12 ...
分类:
其他好文 时间:
2014-09-08 01:00:16
阅读次数:
200
Say you have an array for which theithelement is the price of a given stock on dayi.Design an algorithm to find the maximum profit. You may complete a...
分类:
其他好文 时间:
2014-09-07 14:41:25
阅读次数:
240