- 博客(21)
- 收藏
- 关注
翻译 windows 进程通信之管道详解 :
在项目中用到了Windows进程通信 ,需要用管道读子进程的标准输入,输出,于是研究了MSDN上的相关代码代码源地址https://msdn.microsoft.com/en-us/library/windows/desktop/ms682516(v=vs.85).aspx#include #include #include #include #define BUFS
2016-07-21 21:31:43
2605
原创 二师弟的星际加法
我是网络公司的一名普通程序员,英文名Steven,发音比较像“师弟”,自从入职培训自我介绍后,大家就称我为“二师弟”,我喜欢看科幻小说,也喜欢做梦,有一次梦到外星球,发现外星人使用的并非10进制/16进制等,有些星球居然使用N进制(据统计N都在2~35之间),现在我们将首先给您一个数字表示N进制,然后给出两个数字的字符串,请算出其求和结果并输出,如果输入不能正常计算则输出-1。 说明:1:数字的字
2016-03-31 22:01:50
652
原创 C++虚函数表
#include#include#include#include#include#includetypedef void(*Fun)(void);using namespace std;class test{public: virtual void print(void){ cout << "HELLO world1111!" << endl; } virtual vo
2016-03-14 21:49:37
247
转载 C++ Singleton设计模式
#include#includeusing namespace std;class Singleton{public: static auto_ptr getInstance(){ cout << "Singleton::getInstance" << endl; if (!sg.get()){ //判断s所指对象是否为空 auto_ptr temp(n
2016-03-11 12:11:11
213
原创 Leetcode123123. Best Time to Buy and Sell Stock III
此题限制交易次数为2次。Say you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may complete at most two transactio
2016-03-11 09:37:01
200
原创 Leetcode128 题目总结(hard)
the first missing positive : 从1开始寻找正整数i,找到就把他交换到nums[i]: class Solution {public: int firstMissingPositive(vector& nums) { int result = 1; for (int i = 0; i < nums.size();
2016-03-11 09:04:06
364
原创 Leetcode122. Best Time to Buy and Sell Stock II
Leetcode122. Best Time to Buy and Sell Stock II:给你每天的股票价格,可以多次交易,求最大收益,当然前提是先买后卖!Say you have an array for which the ith element is the price of a given stock on day i.Design an algorithm
2016-03-10 22:03:23
176
原创 Leecode121. Best Time to Buy and Sell Stock
Leecode121. 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
2016-03-10 21:59:35
243
原创 二叉树的后续遍历
Leetcode145. Binary Tree Postorder Traversal 给定使用数组保存的二叉树,返回其后续遍历Given a binary tree, return the postorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3},
2016-03-10 21:55:00
411
原创 二叉树的遍历
中序遍历:void InorderTraversal( BinTree BT ){ if( BT ) { InorderTraversal( BT->Left ); /* 此处假设对BT结点的访问就是打印数据 */ printf("%d ", BT->Data); /* 假设数据为整型 */ InorderTraversal
2016-03-10 11:17:39
226
原创 232. Implement Queue using Stacks
题目:232. Implement Queue using Stacks Difficulty: Easy 使用堆实现队列 Implement the following operations of a queue using stacks.push(x) -- Push element x to the
2016-03-10 10:28:44
160
原创 Leetcode299. Bulls and Cows
题目:You are playing the following Bulls and Cows game with your friend: You write down a number and ask your friend to guess what the number is. Each time your friend makes a guess, you provide
2016-03-08 17:12:15
219
转载 C++中的RAII机制详解
前言在写C++设计模式——单例模式的时候,在写到实例销毁时,设计的GC类是很巧妙的,而这一巧妙的设计就是根据当对象的生命周期结束时会自动调用其析构函数的,而这一巧妙的设计也是有专业的名词的——RAII。那以下将围绕RAII,全面的讲解RAII的相关知识。什么是RAII?RAII是Resource Acquisition Is Initialization的简称,是C++语言
2016-03-04 21:11:00
643
原创 Leetcode13. Roman to Integer
Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.Subscribe to see which companies asked this questionC++代码: int romanToInt(
2016-03-03 21:21:24
189
原创 Leetcode263. Ugly Number
Write a program to check whether a given number is an ugly number.Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For example, 6, 8 are ugly while 14 is not ugly sinc
2016-03-03 21:13:19
182
原创 Leetcode217. Contains Duplicate
Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the array, and it should return false if every element is
2016-03-03 16:55:56
213
原创 Leetcode171. Excel Sheet Column Number
Related to question Excel Sheet Column TitleGiven a column title as appear in an Excel sheet, return its corresponding column number.For example: A -> 1 B -> 2 C -> 3 ...
2016-03-03 16:47:57
176
原创 Leetcode242. Valid Anagram
题目: Given two strings s and t, write a function to determine if t is an anagram of s.For example,s = "anagram", t = "nagaram", return true.s = "rat", t = "car", return false.Note:You
2016-03-03 16:44:50
233
转载 内存地址空间布局
在多任务操作系统中的每一个进程都运行在一个属于它自己的内存沙盘中。这个沙盘就是虚拟地址空间(virtual address space)。1 32位虚拟内存布局在32位模式下虚拟地址空间总是一个4GB的内存地址块。这些虚拟地址通过页表(page table)映射到物理内存,页表由操作系统维护并被处理器引用。每一个进程拥有一套属于它自己的页表,但是还有一个隐情。只要虚拟地址被使用,那
2016-03-03 10:40:57
255
原创 Leetcode283 Move Zeros
Given an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the non-zero elements.For example, given nums = [0, 1, 0, 3, 12], after calling you
2016-03-02 20:39:58
197
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人