04 2017 档案

摘要:题目: Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted i 阅读全文
posted @ 2017-04-12 10:48 回冬 阅读(176) 评论(0) 推荐(0)
摘要:题目: Given an array and a value, remove all instances of that value in place and return the new length. Do not allocate extra space for another array, 阅读全文
posted @ 2017-04-11 20:46 回冬 阅读(157) 评论(0) 推荐(0)
摘要:题目: Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length. Do not allocate extra spac 阅读全文
posted @ 2017-04-11 19:38 回冬 阅读(181) 评论(0) 推荐(0)
摘要:一、测试 二、调试 1、抛出异常——针对可恢复的错误 ① try-except语句 :在调用该函数的代码中 ② raise语句—raise Exception() :在函数中 2、取得反向跟踪的字符串——调用栈 traceback模块 3、断言——针对开发,即程序员的错误 1)assert语句,包括 阅读全文
posted @ 2017-04-06 21:27 回冬 阅读(187) 评论(0) 推荐(0)
摘要:一直不是很理解python中'if __name__ == '__main__':' 的作用,今天查了一下各位大神的博客,总结如下: if 语句有2个作用: 1、可以在这个if下测试函数或类,这一句与c中的main()函数所表述的是一致的,即作为入口; (这种情况可以看我刚整理的一篇博客:http: 阅读全文
posted @ 2017-04-05 17:35 回冬 阅读(330) 评论(0) 推荐(0)
摘要:题目: Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would hav 阅读全文
posted @ 2017-04-05 16:54 回冬 阅读(496) 评论(0) 推荐(0)