iOS5.0以后就开始可以使用ARC( Automatic Reference Counting:自动引用计数)来代替之前的MRC(Manual Reference Counting:人工引用计数)。使用ARC会减少很多代码和忘了释放对象的苦恼。但是事情都有两面性。使用了ARC之后如果你想复用以前写 ...
分类:
其他好文 时间:
2016-04-18 00:44:46
阅读次数:
129
最近准备刷 leetcode 做到了一个关于位运算的题记下方法 int cunt = 0; while(temp) { temp = temp&(temp - 1); //把二进制最左边那个1变为零 count++; //统计1的个数 } 同理把位二进制坐左边那个0变为1 就可以 temp = te ...
分类:
其他好文 时间:
2016-04-17 20:33:38
阅读次数:
116
在ios编程中,如果成员变量为对象,我们需要对成员变量内存管理,否则,会造成内存泄露。即我们要对成员变量进行手动的内存释放。 很显然,是ARC的问题。 错误原因:在创建工程的时候点选了“Use Automatic Reference Counting”选项,但是又调用了对象的release方法 AR ...
分类:
其他好文 时间:
2016-04-16 23:02:20
阅读次数:
254
题目: Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1's in their binary representation a ...
分类:
其他好文 时间:
2016-04-14 20:57:58
阅读次数:
154
Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1's in their binary representation and r ...
分类:
其他好文 时间:
2016-04-14 12:18:40
阅读次数:
111
Xcode更新到7.3后会出现NSObject+MJProperty.h 报Cannot create __weak reference in file using manual reference counting错误信息。 修改方法 在Building Setting中改一下设置 改为 YES就 ...
分类:
其他好文 时间:
2016-04-13 18:55:14
阅读次数:
198
n*m的矩阵W是水 .是地问有多少池塘池塘的定义是:W通过 八个 方向连接成的一片算作是一个池塘样例输入中,有左上、左下、右侧三片连接在一起的W因而样例输出给出了3个池塘的答案 ...
分类:
其他好文 时间:
2016-04-11 20:51:45
阅读次数:
175
LeetCode338.CountingBitsGivenanonnegativeintegernumbernum.Foreverynumbersiintherange0≤i≤numcalculatethenumberof1‘sintheirbinaryrepresentationandreturnthemasanarray.Example:Fornum=5youshouldreturn[0,1,1,2,1,2].Followup:Itisveryeasytocomeupwithasolutionwith..
分类:
其他好文 时间:
2016-04-11 18:57:10
阅读次数:
123
Question: Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1's in their binary representa ...
分类:
其他好文 时间:
2016-04-11 11:45:26
阅读次数:
142
题目链接 题意:给定长度为n(n <= 1000)的只含小写字母的字符串,问字符串子串不重叠出现最少两次的不同子串个数; input: aaaa ababcabb aaaaaa # output 2 3 3 思路:套用后缀数组求解出sa数组和height数组,之后枚举后缀的公共前缀长度i,由于不能重 ...
分类:
编程语言 时间:
2016-04-10 23:58:53
阅读次数:
610