摘要: Given a 2D integer matrix M representing the gray scale of an image, you need to design a smoother to make the gray scale of each cell becomes the ave 阅读全文
posted @ 2018-04-01 23:37 bonelee 阅读(199) 评论(0) 推荐(0)
摘要: >>> a=[[0]*3 for i in range(3)]>>> a[[0, 0, 0], [0, 0, 0], [0, 0, 0]]>>> a[1][1]=121>>> a[[0, 0, 0], [0, 121, 0], [0, 0, 0]]>>> a[0][0]=11>>> a[[11, 0 阅读全文
posted @ 2018-04-01 23:37 bonelee 阅读(668) 评论(0) 推荐(0)
摘要: Suppose Andy and Doris want to choose a restaurant for dinner, and they both have a list of favorite restaurants represented by strings. You need to h 阅读全文
posted @ 2018-04-01 22:46 bonelee 阅读(227) 评论(0) 推荐(0)
摘要: 参数解释: (1)iterable指定要排序的list或者iterable,不用多说; (2)cmp为函数,指定排序时进行比较的函数,可以指定一个函数或者lambda函数,如: students为类对象的list,没个成员有三个域,用sorted进行比较时可以自己定cmp函数,例如这里要通过比较第三 阅读全文
posted @ 2018-04-01 22:26 bonelee 阅读(25803) 评论(0) 推荐(1)
摘要: Given n points in the plane that are all pairwise distinct, a "boomerang" is a tuple of points (i, j, k) such that the distance between i and j equals 阅读全文
posted @ 2018-04-01 22:16 bonelee 阅读(278) 评论(0) 推荐(0)
摘要: Given a non-empty array of non-negative integers nums, the degree of this array is defined as the maximum frequency of any one of its elements. Your t 阅读全文
posted @ 2018-04-01 21:07 bonelee 阅读(220) 评论(0) 推荐(0)
摘要: Reverse a singly linked list. click to show more hints. 精简下代码: 递归解: dfs 记得程序员面试金典里专门提过! 阅读全文
posted @ 2018-04-01 16:46 bonelee 阅读(155) 评论(0) 推荐(0)
摘要: Given scores of N athletes, find their relative ranks and the people with the top three highest scores, who will be awarded medals: "Gold Medal", "Sil 阅读全文
posted @ 2018-04-01 12:29 bonelee 阅读(179) 评论(0) 推荐(0)
摘要: Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the arr 阅读全文
posted @ 2018-04-01 10:36 bonelee 阅读(139) 评论(0) 推荐(0)