2015年8月17日

(一二三)基于GCD的dispatch_once实现单例设计

摘要: 要实现单例,关键是要保证类的alloc和init只被调用一次,并且被自身强引用防止释放。 近日读唐巧先生的《iOS开发进阶》,受益匪浅,通过GCD实现单例就是收获之一,下面把这个方法与大家分享。 在GCD中,有一个函数dispatch_once,可以实现代码段的一次性执行,和static修饰的... 阅读全文

posted @ 2015-08-17 21:02 张大大123 阅读(152) 评论(0) 推荐(0) 编辑

1084. Broken Keyboard (20)

摘要: 题目如下: On a broken keyboard, some of the keys are worn out. So when you type some sentences, the characters corresponding to those keys will not a... 阅读全文

posted @ 2015-08-17 19:14 张大大123 阅读(134) 评论(0) 推荐(0) 编辑

1081. Rational Sum (20) -最大公约数

摘要: 题目如下: Given N rational numbers in the form "numerator/denominator", you are supposed to calculate their sum. Input Specification: Each input fi... 阅读全文

posted @ 2015-08-17 19:10 张大大123 阅读(188) 评论(0) 推荐(0) 编辑

导航