描述:不使用 * / % 完成除法操作。O(n)复杂度会超时,需要O(lg(n))复杂度。代码: 1 class Solution: 2 # @return an integer 3 def dividePositive(self, dividend, divisor): 4 ...
分类:
其他好文 时间:
2014-07-16 19:18:00
阅读次数:
298
NSString *stringClass = NSStringFromClass([(UINavigationController *)self.window.rootViewController topViewController].class);
分类:
移动开发 时间:
2014-07-16 19:00:17
阅读次数:
245
```pythonimport win32con,win32guiclass MyWindow(): def __init__(self): #注册一个窗口类 wc = win32gui.WNDCLASS() wc.lpszClassName = 'M...
// 一个按钮点击事件,判断点击按钮是那一个显示出他的信息- (IBAction)buttonPressed:(id)sender { if (sender == self.leftButton) { NSLog(@"%@", self.leftButton.currentTit...
分类:
其他好文 时间:
2014-07-16 18:19:06
阅读次数:
167
1 /* 九宫格计算 */ 2 int totalCol = 5;//指定总列数 3 4 CGFloat viewW = 50;//subview宽度 5 CGFloat viewH = 50;//subview高度 6 7 CGFloat marginX = (self.view.bound...
分类:
移动开发 时间:
2014-07-16 18:15:23
阅读次数:
204
import sys class Stats: def __init__(self, sequence): # sequence of numbers we will process # convert all items to floats for numeri...
分类:
编程语言 时间:
2014-07-16 18:06:48
阅读次数:
257
题目分析见这里
class Solution:
# @param head, a ListNode
# @return a list node
def detectCycle(self, head):
if None == head or None == head.next:
return None
pfast = ...
分类:
编程语言 时间:
2014-07-16 17:18:53
阅读次数:
248
近日遇到一个很细的知识点,关于block的循环引用问题,相比很多人都遇到了,也能顺利解决了,至于block方面的技术文章,那就更多了,这里不再赘述,但是有这样一个问题:
What the difference between __weak and __block reference?
使用场景:
__block typeof(self) tmpSelf = self;
[self meth...
分类:
其他好文 时间:
2014-07-16 17:09:11
阅读次数:
203
class Solution:
# @param head, a ListNode
# @return a boolean
def hasCycle(self, head):
if None == head or None == head.next:
return False
pfast = head
...
分类:
编程语言 时间:
2014-07-16 09:50:21
阅读次数:
271
面向对象的基础是类,但Lua中没有提供类的概念,所以我们需要利用Lua现有的机制来实现类似于类的有关oop的一整套概念。基本方案是使用table来实现类机制,并且结合使用self参数和冒号操作。我们先来看看self参数和冒号操作符的用法: self参数的使用是很多面向对象语言的要点,大多数OO...
分类:
其他好文 时间:
2014-07-16 00:43:18
阅读次数:
296