摘要: 0. The following content is from : https://developers.google.com/protocol-buffers/docs/overview 1. What are protocol buffers Protocol buffers are a fl 阅读全文
posted @ 2020-03-04 09:06 心怀阳光 阅读(110) 评论(0) 推荐(0) 编辑
摘要: 0. 1. Array Its size is fixed; The size must be known at compile-time; 2. Examples const unsigned buf_size = 512; int ia[buf_size]; // an empty array, 阅读全文
posted @ 2020-02-11 08:13 心怀阳光 阅读(150) 评论(0) 推荐(0) 编辑
摘要: 0. 1. Standard library header <algorithm> #include <algorithm> // for sort std::array<int,10> s = {5,7,2,8,6,1,9,0,3}; // initial an array std::sort(s 阅读全文
posted @ 2020-02-11 07:33 心怀阳光 阅读(192) 评论(0) 推荐(0) 编辑
摘要: 0. 1. Implement a singleton class class MySingleton{ public: static MySingleton* const p_single; private: MySingleton(void){cout << "private construct 阅读全文
posted @ 2020-01-28 03:05 心怀阳光 阅读(87) 评论(0) 推荐(0) 编辑
摘要: 0. 1. syntax int foo[5]; // an array of int, an empty array int foo[5] = {16, 2, 77, 40, 123}; // an array of int with initilization int* ptr[5]; // a 阅读全文
posted @ 2020-01-27 08:59 心怀阳光 阅读(235) 评论(0) 推荐(0) 编辑
摘要: 0. General speaking static is a keyword in C++, and it can be used in variables, functions, and members of a class. 1. static members of a class stati 阅读全文
posted @ 2020-01-27 08:33 心怀阳光 阅读(113) 评论(0) 推荐(0) 编辑
摘要: 想在ubuntu 14.04 上开发C#, 能用的有Mono Mono is a runtime environment that can run .NET applications and that works on both Windows and Linux. It includes a C# 阅读全文
posted @ 2020-01-25 03:27 心怀阳光 阅读(152) 评论(0) 推荐(0) 编辑
摘要: 0. 1. examples: def fib(n): if n == 1 or n == 2: result = 1 else result = fib(n-1) + fib(n-2) return result this is very in-efficient, O(2^n), and we 阅读全文
posted @ 2020-01-24 04:00 心怀阳光 阅读(107) 评论(0) 推荐(0) 编辑
摘要: 42. Trapping Rain Water we need to find how many waters can each bar[i] trap. So we need to find the left peak from barto bar[i-1] and find the right 阅读全文
posted @ 2020-01-23 06:09 心怀阳光 阅读(104) 评论(0) 推荐(0) 编辑
摘要: 0. 1. strcpy() function #include <string.h> char* strcpy(char* destination, const char* source); 2. Allocating Memory dynamically: (1) void* malloc(in 阅读全文
posted @ 2020-01-21 12:51 心怀阳光 阅读(132) 评论(0) 推荐(0) 编辑