摘要:
转换构造函数 定义 作用:将指定类型的数据转换为类的对象。 1. 参数仅包含一个非本类const引用类型的参数 2. 参数可以进行隐式转换如int->float 可以通过explicit来禁止隐式转换。 举例: 类型转换函数 定义 作用:将一个类对象转换成另一个类型的数据 1. 该函数必须为成员函数 阅读全文
摘要:
Implement strStr(). Return the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack. Example 1: Example 2: 使用K 阅读全文
摘要:
1、字符串包含问题 1)串的模式匹配算法 (LintCode:字符串查找) BF KMP 阅读全文
摘要:
Given a non-empty integer array, find the minimum number of moves required to make all array elements equal, where a move is incrementing a selected e 阅读全文
摘要:
关于对结构体求sizeof。需要考虑一下几点: 1、内存对齐 2、机器的位数(32 or 64) 3、是否含有虚函数 4、继承关系 5、static不归入sizeof 6、普通成员函数与sizeof无关 以32位系统为例 Exp 1 空类:占用1个字节。 Exp 2 虚函数:占用4个字节 Exp 3 阅读全文
摘要:
Given a string S, we can transform every letter individually to be lowercase or uppercase to create another string. Return a list of all possible stri 阅读全文
摘要:
Given a Binary Search Tree (BST) with the root node root, return the minimum difference between the values of any two different nodes in the tree. Exa 阅读全文
摘要:
Given the root of a tree, you are asked to find the most frequent subtree sum. The subtree sum of a node is defined as the sum of all the node values 阅读全文
摘要:
Given a list of directory info including directory path, and all the files with contents in this directory, you need to find out all the groups of dup 阅读全文
摘要:
Given an array of numbers nums, in which exactly two elements appear only once and all the other elements appear exactly twice. Find the two elements 阅读全文