摘要: Have an arraywe have to find longest subarray with consecutive numbersex [4,5,34,33,32,11,10,31]answer is[31,32,33,34][92 26 30 28 27]answer is [27, 28]NOT [26, 27, 28]because 26, 27, and 28 are not in a contiguous subarray 阅读全文
posted @ 2013-01-25 16:37 百分百好牛 阅读(123) 评论(0) 推荐(0) 编辑
摘要: Q:假设你可以回到昨天,并且得到股市昨天的全天每个时刻的数据,你能够通过买卖交易,赚取最多的钱么?比如:1. {10, 20, 15, 18, 22, 20, 4, 5}{买入 卖出} {10, 20} {15, 22} {4, 5} 一共三次交易,赚了 10 + 7 + 1 = 18块钱2. {5, 10, 9, 10, 11, 11, 12, 100}{5, 10} {9, 100} 两次交易,赚了 5 + 91 = 96,是最多的钱。条件:1. 不计手续费2. 一次买+卖算一次完整交易3. 买入后,在卖出前,不能再买入(意思是,交易不能交叉)问题:1. 如果没有其它限制,只让你尽可能多的 阅读全文
posted @ 2013-01-25 15:08 百分百好牛 阅读(174) 评论(0) 推荐(0) 编辑
摘要: The following is an implementation of the CMWC algorithm in theC programming language. Also, included in the program is a sample initialization function. In this implementation the lagr=4096. The period of the resulting generator is about.#include <stdint.h> #define PHI 0x9e3779b9 static uint3 阅读全文
posted @ 2013-01-25 10:30 百分百好牛 阅读(437) 评论(0) 推荐(0) 编辑