上一页 1 ··· 158 159 160 161 162 163 164 165 166 ··· 273 下一页
摘要: def qsort(arr, start, end): if start > end: return def partition(arr, start, end): pivot = arr[start] i = start+1 while i start: arr[start], arr[end] ... 阅读全文
posted @ 2018-04-16 10:38 bonelee 阅读(570) 评论(0) 推荐(0)
摘要: Given an array nums and a value val, remove all instances of that value in-place and return the new length. Do not allocate extra space for another ar 阅读全文
posted @ 2018-04-15 22:00 bonelee 阅读(153) 评论(0) 推荐(0)
摘要: We define a harmonious array is an array where the difference between its maximum value and its minimum value is exactly 1. Now, given an integer arra 阅读全文
posted @ 2018-04-15 19:55 bonelee 阅读(225) 评论(0) 推荐(0)
摘要: Given an integer, write an algorithm to convert it to hexadecimal. For negative integer, two’s complement method is used. Note: Example 1: Example 2: 阅读全文
posted @ 2018-04-14 23:32 bonelee 阅读(227) 评论(0) 推荐(0)
摘要: Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists. Example: 阅读全文
posted @ 2018-04-14 22:33 bonelee 阅读(256) 评论(0) 推荐(0)
摘要: You are climbing a stair case. It takes n steps to reach to the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can you cl 阅读全文
posted @ 2018-04-14 13:09 bonelee 阅读(272) 评论(0) 推荐(0)
摘要: Given a binary tree, return all root-to-leaf paths. For example, given the following binary tree: All root-to-leaf paths are: stack 迭代解法: BFS:(和dfs st 阅读全文
posted @ 2018-04-14 12:58 bonelee 阅读(182) 评论(0) 推荐(0)
摘要: Given a list of strings words representing an English Dictionary, find the longest word in words that can be built one character at a time by other wo 阅读全文
posted @ 2018-04-14 11:55 bonelee 阅读(348) 评论(0) 推荐(0)
摘要: from:https://www.cnblogs.com/justinh/p/7716421.html Trie,又经常叫前缀树,字典树等等。它有很多变种,如后缀树,Radix Tree/Trie,PATRICIA tree,以及bitwise版本的crit-bit tree。当然很多名字的意义其实 阅读全文
posted @ 2018-04-14 10:52 bonelee 阅读(53737) 评论(1) 推荐(7)
摘要: features = sc.parallelize(data_group[idx]).map(lambda x: (x.host_ip+'^'+x.domain, 1)).reduceByKey(operator.add).map(get_domain_features) def get_domai 阅读全文
posted @ 2018-04-13 11:02 bonelee 阅读(556) 评论(0) 推荐(0)
上一页 1 ··· 158 159 160 161 162 163 164 165 166 ··· 273 下一页