Google代码规范之C++ You may need to read in http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml。
Path Sum path-sum递归:如果使用递归,需要明确递归的结束条件,结束条件分为几类。递归的模式为:Type f(...) { if 满足结束条件1 return x; if 满足结束条件2 return x; ...... 递归表达式}
Single Number II 题目Given an array of integers, every element appears three times except for one. Find that single one.Note:Your algorithm should have a linear runtime complexity. Could you implement it wit
Single Number //空间O(n), 时间O(nlogn)class Solution {public: int singleNumber(int A[], int n) { set se; for (int i = 0; i < n; ++i) { auto it = se.find(A[i]); if (it == s
Binary Tree Preorder Traversal 题目分析复杂度输入CODE/** * Definition for binary tree * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL)
Insertion Sort List 题目CODE/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */ typede
单链表C语言实现(Need edition) CODE:Cyuyan#include #include #include typedef int ElemType;typedef struct _ListNode{ ElemType data; struct ListNode* next;}ListNode;ListNode * initSList();int isEmpty(ListNode *hea
自定义map比较规则及函数调用 参考文章:http://blog.csdn.net/challenge_c_plusplus/article/details/7429963#include #include #include #include using namespace std;bool my_compare(const string &str1, const string &str2){ retu
Evaluate Reverse Polish Notation 题目Evaluate the value of an arithmetic expression in Reverse Polish Notation.Valid operators are +, -, *, /. Each operand may be an integer or another expression.Some examples: ["2