随笔分类 - 算法
摘要:1 typedef struct node{ 2 int val; 3 struct node *left, *right; 4 }TreeNode; 5 //求二叉树的节点个数。 6 int GetNodeNum(TreeNode *pRoot){ 7 if(pRoot == NULL) 8 return 0; 9 ...
阅读全文
摘要:Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times. You may assume that the
阅读全文