上一页 1 ··· 3 4 5 6 7 8 下一页
Given an indexk, return thekthrow of the Pascal's triangle.For example, givenk= 3,Return[1,3,3,1].Note:Could you optimize your algorithm to use onlyO(... Read More
posted @ 2015-05-05 10:20 sunalive Views(133) Comments(0) Diggs(0)
由虚函数实现的动态多态性就是: 同一类族中不同类的对象,对同一函数调用作出不同的响应。虚函数的使用方法是:(1) 在基类用virtual声明成员函数为虚函数。这样就可以在派生类中重新定义此函数,为它赋予新的功能,并能方便地被调用。在类外定义虚函数时,不必再加virtual。(2) 在派生类中重新定义... Read More
posted @ 2015-04-29 16:53 sunalive Views(260) Comments(0) Diggs(0)
class Solution {public: int removeElement(int A[], int n, int elem) { int cnt = 0; for(int i=0;i<n;i++) { i... Read More
posted @ 2015-04-29 10:10 sunalive Views(95) Comments(0) Diggs(0)
由于太久远了,已经忘记作者是谁了,如果看到了,真的对不起,希望能给我留个言(我的QQ:543451622)void split(const string& src, const string& separator, vector& dest){ string str = src; str... Read More
posted @ 2015-03-31 16:37 sunalive Views(261) Comments(0) Diggs(0)
问题描述:Rotate an array ofnelements to the right byksteps.For example, withn= 7 andk= 3, the array[1,2,3,4,5,6,7]is rotated to[5,6,7,1,2,3,4].Note:Try to... Read More
posted @ 2015-03-31 11:28 sunalive Views(100) Comments(0) Diggs(0)
Given an integern, return the number of trailing zeroes inn!.最初的代码class Solution {public: int trailingZeroes(int n) { long long int fac = 1; ... Read More
posted @ 2015-03-30 15:00 sunalive Views(120) Comments(0) Diggs(0)
//模板类 用于将string类型转化为 常用数值类型template Type stringToNum(const string& str){ istringstream iss(str); Type num; iss >> num; return num;}int main(int argc, ... Read More
posted @ 2015-03-29 15:11 sunalive Views(217) Comments(0) Diggs(0)
http://blog.csdn.net/qh_java/article/details/9084091 Read More
posted @ 2015-03-23 10:04 sunalive Views(91) Comments(0) Diggs(0)
http://blog.sina.com.cn/s/blog_61437b3b0102v0bt.htmlhttp://blog.csdn.net/chenwk891/article/details/8776479在C\C++中,文件操作都是由库函数来实现的,主要是分为读和写两种操作,以下详细讲解以下... Read More
posted @ 2015-03-18 17:07 sunalive Views(222) Comments(0) Diggs(0)
class Solution {public: int reverse(int x) { int flag = 1; long long x1 = x; if(x1 0 && result > 2147483647) return 0; ... Read More
posted @ 2015-03-16 20:04 sunalive Views(126) Comments(0) Diggs(0)
上一页 1 ··· 3 4 5 6 7 8 下一页