摘要: 1 def f(x): 2 return x*x 3 print map(f,[1,2,3,4,5]) 4 5 [1, 4, 9, 16, 25] 6 7 def format_names(s): 8 return s[0].upper()+s[1:].lower() 9 pr... 阅读全文
posted @ 2015-09-03 20:41 小榛子 阅读(126) 评论(0) 推荐(0) 编辑
摘要: https://leetcode.com/problems/merge-sorted-array/Merge Sorted ArrayGiven two sorted integer arraysnums1andnums2, mergenums2intonums1as one sorted arra... 阅读全文
posted @ 2015-07-05 12:03 小榛子 阅读(183) 评论(0) 推荐(0) 编辑
摘要: https://leetcode.com/problems/remove-element/Remove ElementGiven an array and a value, remove all instances of that value in place and return the new ... 阅读全文
posted @ 2015-07-05 11:35 小榛子 阅读(270) 评论(0) 推荐(0) 编辑
摘要: https://leetcode.com/problems/remove-duplicates-from-sorted-array-ii/Remove Duplicates from Sorted Array IIFollow up for "Remove Duplicates":What if d... 阅读全文
posted @ 2015-07-05 11:06 小榛子 阅读(105) 评论(0) 推荐(0) 编辑
摘要: https://leetcode.com/problems/remove-duplicates-from-sorted-array/Remove Duplicates from Sorted ArrayGiven a sorted array, remove the duplicates in pl... 阅读全文
posted @ 2015-07-05 10:12 小榛子 阅读(141) 评论(0) 推荐(0) 编辑
摘要: https://leetcode.com/problems/insert-interval/Insert IntervalGiven a set ofnon-overlappingintervals, insert a new interval into the intervals (merge i... 阅读全文
posted @ 2015-07-03 11:41 小榛子 阅读(206) 评论(0) 推荐(0) 编辑
摘要: https://leetcode.com/problems/merge-intervals/Merge IntervalsGiven a collection of intervals, merge all overlapping intervals.For example,Given[1,3],[... 阅读全文
posted @ 2015-07-03 11:22 小榛子 阅读(222) 评论(0) 推荐(0) 编辑
摘要: https://leetcode.com/problems/sort-colors/Sort ColorsGiven an array withnobjects colored red, white or blue, sort them so that objects of the same col... 阅读全文
posted @ 2015-07-03 10:27 小榛子 阅读(408) 评论(0) 推荐(0) 编辑
摘要: https://leetcode.com/problems/insertion-sort-list/Insertion Sort ListSort a linked list using insertion sort.题目:插入排序 1 # Definition for singly-linked ... 阅读全文
posted @ 2015-07-02 21:20 小榛子 阅读(110) 评论(0) 推荐(0) 编辑
摘要: https://leetcode.com/problems/sort-list/Sort ListSort a linked list inO(nlogn) time using constant space complexity.来自http://www.cnblogs.com/zuoyuan/p... 阅读全文
posted @ 2015-07-02 20:41 小榛子 阅读(575) 评论(0) 推荐(0) 编辑