摘要: void reverse(char *str){ char* end = str; char tmp; if (str){ while (*end != '\0'){ // 找出字符串的末尾 ++end; } } end--; // 回退一个字符 // 从字符串... 阅读全文
posted @ 2017-10-30 22:51 爱简单的Paul 阅读(322) 评论(0) 推荐(0) 编辑
摘要: // 思路:左右两个指针,左右两个和,当左边和大的时候右边指针左移一位,和增加一个数 int findIndex (vector nums){ if (nums == NULL) return -1; if (nums.size() == 1) return 0; int left = nums[0], l = 0, right = nums[nums.size()... 阅读全文
posted @ 2017-10-30 22:41 爱简单的Paul 阅读(324) 评论(2) 推荐(0) 编辑
摘要: 1. 一棵二叉树,遍历第三层的结点:在递归过程中加入一个结点高度的参数,一旦高度等于3便输出 2. 给一个十进制数,输出转化为二进制后的最后8位。 3. 自己写一个Stack类,要实现push、pop操作 4. 在数组中取一个位置,让这个位置之前的树的和与之后的和的差绝对值最小 5. 二分查找 ,动 阅读全文
posted @ 2017-10-30 22:29 爱简单的Paul 阅读(283) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). For example, this binary tree [1,2,2,3,4,4,3] is symmet 阅读全文
posted @ 2017-10-30 18:51 爱简单的Paul 阅读(155) 评论(0) 推荐(0) 编辑
摘要: Given an array with n integers, your task is to check if it could become non-decreasing by modifying at most 1 element. We define an array is non-decr 阅读全文
posted @ 2017-10-30 17:44 爱简单的Paul 阅读(187) 评论(0) 推荐(0) 编辑