![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
剑指offer
BeMoreStrong
武汉大学通信系毕业,现是渣渣硕一枚,希望用csdn记录自己的成长,找到一份称心的工作
展开
-
专题:数组中数字出现的次数
利用异或的特性 1. a ^ a = 02. a ^ 0 = a3. a = a ^ b ^ b题目一、数组中唯一只出现一次的数字一次异或,得到最后的数字即为答案int FindOnceNum(int arr[], int len) { if (arr == NULL || len <= 0) return -1; int ret = 0; for (int i = 0; i&...原创 2018-05-26 19:12:00 · 199 阅读 · 0 评论 -
反转链表
1、保存下一个节点防止链表断裂2、保存上一个节点,反转链表class Solution { public: ListNode* ReverseList(ListNode* pHead) { if (NULL == pHead) return NULL; ListNode* pNode = pHead; //当前指针 往下走 ...原创 2018-06-08 21:40:08 · 116 阅读 · 0 评论