摘要: Sqrt(x) 要点:binary search很容易想,注意corner cases:如果 =2,high的初始值为x/2,所以对x=0 or x=1特殊处理,否则设定x为high初始值会TLE class Solution(object): def mySqrt(self, x): """ :t 阅读全文
posted @ 2016-04-22 10:47 absolute100 阅读(68) 评论(0) 推荐(0) 编辑
摘要: Text Justification 细节实现题,基本结构是逐层填(外循环),maintain每层的start和end:start代表开始点,end在每层开始为start。在内层循环找到本层的end。找法是前向比较。最终end点落在本层end的下一个位置 corner cases以及解法or错误点 阅读全文
posted @ 2016-04-22 10:46 absolute100 阅读(106) 评论(0) 推荐(0) 编辑