27 iOS open source libraries to skyrocket your development.You don’t want to miss them. Really.下面献上原文地址链接:https://medium.com/ios-os-x-development/27-i...
分类:
其他好文 时间:
2015-06-17 14:42:10
阅读次数:
127
题目意思:全排列思路:其实看这题目意思,是不太希望用递归的,不过还是用了递归,非递归的以后再搞吧 ps:vector这玩意不能随便返回,开始递归方法用vector,直接到500ms,换成void,到12ms 1 class Solution { 2 public: 3 vector> pe...
分类:
其他好文 时间:
2015-06-14 22:35:33
阅读次数:
185
题目意思:链表有环,返回true,否则返回false思路:两个指针,一快一慢,能相遇则有环,为空了没环 ps:很多链表的题目:都可以采用这种思路 1 /** 2 * Definition for singly-linked list. 3 * struct ListNode { 4 * ...
分类:
其他好文 时间:
2015-06-14 16:30:04
阅读次数:
133
题目意思:在递增数组中找到目标数的位置,如果目标数不在数组中,返回其应该在的位置。思路:折半查找,和相邻数比较,注意边界 1 class Solution { 2 public: 3 int searchInsert(vector& nums, int target) { 4 ...
分类:
其他好文 时间:
2015-06-14 12:22:42
阅读次数:
98
题目意思:二叉树中序遍历,结果存在vector中解题思路:迭代迭代实现: 1 /** 2 * Definition for a binary tree node. 3 * struct TreeNode { 4 * int val; 5 * TreeNode *left; 6...
分类:
其他好文 时间:
2015-06-14 09:22:11
阅读次数:
128
题目意思:二叉树先序遍历,结果存在vector中解题思路:1.递归(题目中说用递归做没什么意义,我也就贴贴代码吧) 2.迭代迭代实现: 1 class Solution { 2 public: 3 vector preorderTraversal(TreeNode* root) { ...
分类:
其他好文 时间:
2015-06-13 15:36:18
阅读次数:
110
题目意思:x为double,n为int,求x的n次方思路分析:直接求,注意临界条件 1 class Solution { 2 public: 3 double myPow(double x, int n) { 4 if(x==1.0)return x; 5 e...
分类:
其他好文 时间:
2015-06-13 06:16:35
阅读次数:
121
题目意思:一个int数组,有一个数只出现一次,其他数均出现两次,找到这个唯一数知识普及:~:非运算,单目运算符1为0,0为1; &:与运算,都为1则为1,否则为0 |:或运算,全为0则为0,否则为1 ^:异或运算,相同为0,不同为1思路:将数组中元素进行异或运算,则只剩下0...
分类:
其他好文 时间:
2015-06-12 11:31:24
阅读次数:
102
我常常浏览的博客和网站http://www.jianshu.com/p/e5353a1a752c?utm_campaign=maleskine&utm_content=note&utm_medium=pc_author_hots&utm_source=recommendation英文系列网站Rayw...
分类:
Web程序 时间:
2015-06-11 16:22:09
阅读次数:
107
Well, a medium problem. Use two pointers. One points to the curren number and the other points to the last unique number. Once duplicates occur, move ...
分类:
其他好文 时间:
2015-06-09 23:22:45
阅读次数:
122