New features
Add automaticlly check libc interfaces
Support custom allocator
Add trace for allocator in the debug mode
Add static_pool module
Add stream interfaces for reading all data to string
Add adler32 hash algorithm
Add tb_memmem interface
Add regex module with pcre, pcre2 or posix regex
Changes
Optimize stre继续阅读 »
I have trained my algorithm on leetcode a period of time.
Today, I will explain my solution about Minimum Height Trees.
My solution beat ~95% against others but it is hard to explain what is I do.
Please allow me to introduce the solution from easy to hard. If you only need the
last solution, jump to继续阅读 »
策略模式-Strategy Pattern
GitHub源码
定义
The Strategy Pattern defines a family of algorithms(演算法;运算法则;),encapsulates( 总结; 扼要概括; ) each one,and makes them interchangeable(可交换的;可交替的;).Strategy lets the algorithm vary independently from clients that use it.继续阅读 »
231. Power of Two
Question
Given an integer, write a function to determine if it is a power of two.
Solution
Approach #1 (count the number of 1) [Accepted]
Algorithm
Integer is a power of two means only one bit of n is '1', for example, 100 is 2^2=4 while 110 is 2^2+2^1=6.继续阅读 »