上一页 1 2 3 4 5 6 7 8 ··· 25 下一页
摘要: 思路: 类似KMP不回朔的思想。start表示开始的点,sum表示当前汽车的油量。当汽车到达汽油站i时如果不能到达下一站,则更新start直到可以使汽车能够从当前节点到达下一站,如果不存在,则把start设置为下一站。 阅读全文
posted @ 2013-10-05 00:01 冰点猎手 阅读(408) 评论(0) 推荐(0) 编辑
摘要: 剑指offer里面的一道题,具体思路看不懂请查阅剑指offer 阅读全文
posted @ 2013-10-04 23:21 冰点猎手 阅读(475) 评论(0) 推荐(0) 编辑
摘要: 分析: 统计每一位1出现的个数,最后摸3求余数,1则置最终位为1 阅读全文
posted @ 2013-10-03 23:34 冰点猎手 阅读(252) 评论(0) 推荐(0) 编辑
摘要: A message containing letters from A-Z is being encoded to numbers using the following mapping:'A' -> 1'B' -> 2...'Z' -> 26Given an encoded message containing digits, determine the total number of ways to decode it.For example,Given encoded message "12", it 阅读全文
posted @ 2013-10-03 13:50 冰点猎手 阅读(177) 评论(0) 推荐(0) 编辑
摘要: template class auto_ptr { public: explicit auto_ptr(T *p = 0); // Item M5 有“explicitfor”// 的描述 template // 拷贝构造函数成员模板 auto_ptr(auto_ptr& rhs); // (见Item M28): // 用另一个类型兼容的 // auto_ptr对象 // 初始化一个新的auto_ptr对象 ~auto_ptr(); template // 赋值操作成员模板 auto_ptr& // (见Item M28): operat... 阅读全文
posted @ 2013-09-29 15:54 冰点猎手 阅读(575) 评论(0) 推荐(0) 编辑
摘要: 转自:http://blog.csdn.net/wangtengqiang/article/details/80618061.static用法static 的成员函数和成员变量,可直接通过类名::函数名或类名::变量名直接访问,该函数名和变量名仅跟类相关联在函数名里定义的static变量,改变它的存储结构,多次调用该函数时,该变量仅被初始化一次全局变量与static的静态变量。改变它的作用域,全局变量的范围是整个程序,而static的静态变量的范围仅有该模块1.1 .h 头文件和.cpp头文件的区别2.多态的机制编绎器会为继承体系上的每一个类创建一个虚函数表,表中的每一次指向虚函数的地址。每个 阅读全文
posted @ 2013-09-29 15:36 冰点猎手 阅读(231) 评论(0) 推荐(0) 编辑
摘要: 转自:C++ how to program// String class definition with operator overloading.#ifndef STRING_H#define STRING_H#include using std::ostream;using std::istream;class String{ friend ostream &operator>( istream &, String & );public: String( const char * = "" ); // conversion/default 阅读全文
posted @ 2013-09-29 14:56 冰点猎手 阅读(451) 评论(0) 推荐(0) 编辑
摘要: Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. /** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */class Solution {public: ListNode *merge(ListN... 阅读全文
posted @ 2013-09-28 20:11 冰点猎手 阅读(156) 评论(0) 推荐(0) 编辑
摘要: Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integers. You may assume that each input would have exactly one solution. For example, given array S = {-1 2 1 -4}, and target = 1. The sum that is close... 阅读全文
posted @ 2013-09-28 01:05 冰点猎手 阅读(466) 评论(0) 推荐(0) 编辑
摘要: Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.Note:Elements in a triplet (a,b,c) must be in non-descending order. (ie, a ? b ? c)The solution set must not contain duplicate triplets. For e... 阅读全文
posted @ 2013-09-28 00:51 冰点猎手 阅读(248) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 ··· 25 下一页