- 博客(10)
- 资源 (1)
- 收藏
- 关注
原创 『lintcode』第k的元素
在数组中找到第k大的元素 注意 你可以交换数组中的元素的位置 样例 给出数组[9,3,2,4,8],第三大的元素是4 给出数组 [1,2,3,4,5],第一大的元素是5,第二大的元素是4,第三大的元素是3,以此类推 code: class Solution { public: /* * param k : description of k
2015-03-23 12:13:26
497
原创 【LEETCODE】Maximum Product Subarray
Find the contiguous subarray within an array (containing at least one number) which has the largest product. For example, given the array [2,3,-2,4], the contiguous subarray [2,3] has the larges
2014-12-02 10:17:53
587
原创 【LEETCODE】Implement strStr().
if(*haystack=='\0'||*needle=='\0') return -1; char *p1=haystack;char *p2=needle;int k=0;char *temp=haystack; while(*p1!='\0'){ if(*p1==*p2){ temp=p1;
2014-11-24 22:25:38
594
转载 用C++开发Hadoop应用程序
假设你有上百G的数据,你要统计出这些数据中,含有某些你感兴趣的内容的数据的有多少条,你会怎么做?在硬件条件允许的情况下,用hadoop并行计算是一个不错的选择。 为了使本文得以清晰地说明,我们不妨假设如下的情况: 我们有100G的数据,分别保存在5个文件中,它们位于 /data/ 目录下。这5个数据文件的内容均为相同的格式,即,文件的内容大致如下: ABCDSDFKJ
2014-10-21 15:35:08
843
原创 VC++6.0 静态常量问题
今天上午阅读STL源码bo #include using namespace std; template class testClass{ public: const static int _datai=5; const static char _datac='c'; }; const int testClass::_datai=1; int main()
2014-09-11 11:57:47
773
原创 【LEETCODE】Reverse Words in a String
class Solution { public: void reverseWords(string &s) { int length=s.length(); string s1="";string s2=""; int k1=length; int k2=0; int flag=0;
2014-09-11 10:04:51
712
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅