12 2015 档案

摘要:maxmax(key=None)Find the maximum item in this RDD.Parameters:key– A function used to generate key for comparing例子:meanmean()Compute the mean of this R... 阅读全文
posted @ 2015-12-30 21:38 loadofleaf 阅读(204) 评论(0) 推荐(0)
摘要:首先在$SPARK_HOME主目录下建立一个test文件夹,里面放一些文件(注意文件全部内容都可被hadoop用户访问,否则运行会出现permission denied的错误)打开pyspark: ./bin/pyspark读入文件整行切割(flatMap, s.split())映射数量(map, ... 阅读全文
posted @ 2015-12-30 15:14 loadofleaf 阅读(131) 评论(0) 推荐(0)
摘要:题目来源https://leetcode.com/problems/permutations-ii/Given a collection of numbers that might contain duplicates, return all possible unique permutations... 阅读全文
posted @ 2015-12-30 11:33 loadofleaf 阅读(296) 评论(0) 推荐(0)
摘要:题目来源https://leetcode.com/problems/permutation-sequence/The set[1,2,3,…,n]contains a total ofn! unique permutations.By listing and labeling all of the ... 阅读全文
posted @ 2015-12-30 11:29 loadofleaf 阅读(510) 评论(0) 推荐(0)
摘要:题目来源https://leetcode.com/problems/permutations/Given a collection ofdistinctnumbers, return all possible permutations.For example,[1,2,3]have the foll... 阅读全文
posted @ 2015-12-30 10:30 loadofleaf 阅读(318) 评论(0) 推荐(0)
摘要:题目来源https://leetcode.com/problems/insert-interval/Given a set ofnon-overlappingintervals, insert a new interval into the intervals (merge if necessary... 阅读全文
posted @ 2015-12-28 22:39 loadofleaf 阅读(268) 评论(0) 推荐(0)
摘要:题目来源https://leetcode.com/problems/merge-intervals/Given a collection of intervals, merge all overlapping intervals.For example,Given[1,3],[2,6],[8,10]... 阅读全文
posted @ 2015-12-28 22:16 loadofleaf 阅读(396) 评论(0) 推荐(0)
摘要:题目来源https://leetcode.com/problems/jump-game-ii/Given an array of non-negative integers, you are initially positioned at the first index of the array.E... 阅读全文
posted @ 2015-12-28 22:00 loadofleaf 阅读(215) 评论(0) 推荐(0)
摘要:题目来源https://leetcode.com/problems/jump-game/Given an array of non-negative integers, you are initially positioned at the first index of the array.Each... 阅读全文
posted @ 2015-12-28 21:37 loadofleaf 阅读(280) 评论(0) 推荐(0)
摘要:题目来源https://leetcode.com/problems/spiral-matrix-ii/Given an integern, generate a square matrix filled with elements from 1 ton2in spiral order.题意分析Inp... 阅读全文
posted @ 2015-12-28 16:33 loadofleaf 阅读(336) 评论(0) 推荐(0)
摘要:题目来源https://leetcode.com/problems/spiral-matrix/Given a matrix ofmxnelements (mrows,ncolumns), return all elements of the matrix in spiral order.题意分析I... 阅读全文
posted @ 2015-12-28 16:20 loadofleaf 阅读(249) 评论(0) 推荐(0)
摘要:题目来源https://leetcode.com/problems/maximum-subarray/Find the contiguous subarray within an array (containing at least one number) which has the largest... 阅读全文
posted @ 2015-12-28 15:14 loadofleaf 阅读(295) 评论(0) 推荐(0)
摘要:题目来源https://leetcode.com/problems/n-queens-ii/Follow up for N-Queens problem.Now, instead outputting board configurations, return the total number of ... 阅读全文
posted @ 2015-12-28 14:45 loadofleaf 阅读(179) 评论(0) 推荐(0)
摘要:题目来源https://leetcode.com/problems/n-queens/Then-queens puzzle is the problem of placingnqueens on ann×nchessboard such that no two queens attack each ... 阅读全文
posted @ 2015-12-28 13:03 loadofleaf 阅读(251) 评论(0) 推荐(0)
摘要:题目来源https://leetcode.com/problems/powx-n/Implement pow(x,n).题意分析Input: x,nOutput:pow(x,n)Conditions:满足一定的内存需求,算法复杂度低一些题目思路刚开始以为直接乘就好了,但是爆内存了,仔细看发现其实可以... 阅读全文
posted @ 2015-12-23 21:32 loadofleaf 阅读(210) 评论(0) 推荐(0)
摘要:需求有时候在shell script里面需要一些执行,如果放在程序里面不便于统一管理,并且每一次修改路径都要去script里面改好麻烦,所以统一把路径放在配置文件中方便管理。问题如何读取相对应的key-value是主要问题,主要是用到IFS分隔符,记住使用时最好先备份原来的IFS,使用完记得还原IF... 阅读全文
posted @ 2015-12-17 22:39 loadofleaf 阅读(1110) 评论(0) 推荐(0)
摘要:题目来源https://leetcode.com/problems/rotate-image/You are given annxn2D matrix representing an image.Rotate the image by 90 degrees (clockwise).Follow up... 阅读全文
posted @ 2015-12-16 18:28 loadofleaf 阅读(239) 评论(0) 推荐(0)
摘要:题目来源https://leetcode.com/problems/multiply-strings/Given two numbers represented as strings, return multiplication of the numbers as a string.Note: Th... 阅读全文
posted @ 2015-12-13 17:26 loadofleaf 阅读(316) 评论(0) 推荐(0)
摘要:题目来源https://leetcode.com/problems/trapping-rain-water/Givennnon-negative integers representing an elevation map where the width of each bar is 1, comp... 阅读全文
posted @ 2015-12-13 16:07 loadofleaf 阅读(253) 评论(0) 推荐(0)
摘要:题目来源https://leetcode.com/problems/first-missing-positive/Given an unsorted integer array, find the first missing positive integer.For example,Given[1,... 阅读全文
posted @ 2015-12-13 15:16 loadofleaf 阅读(170) 评论(0) 推荐(0)
摘要:题目来源https://leetcode.com/problems/sudoku-solver/Write a program to solve a Sudoku puzzle by filling the empty cells.Empty cells are indicated by the c... 阅读全文
posted @ 2015-12-13 14:56 loadofleaf 阅读(314) 评论(0) 推荐(0)
摘要:题目来源https://leetcode.com/problems/combination-sum-ii/Given a collection of candidate numbers (C) and a target number (T), find all unique combinations... 阅读全文
posted @ 2015-12-07 12:47 loadofleaf 阅读(202) 评论(0) 推荐(0)
摘要:题目来源https://leetcode.com/problems/combination-sum/Given a set of candidate numbers (C) and a target number (T), find all unique combinations inCwhere ... 阅读全文
posted @ 2015-12-07 12:33 loadofleaf 阅读(416) 评论(0) 推荐(0)
摘要:题目来源https://leetcode.com/problems/count-and-say/The count-and-say sequence is the sequence of integers beginning as follows:1, 11, 21, 1211, 111221, .... 阅读全文
posted @ 2015-12-01 18:41 loadofleaf 阅读(215) 评论(0) 推荐(0)
摘要:题目来源https://leetcode.com/problems/valid-sudoku/etermine if a Sudoku is valid, according to:Sudoku Puzzles - The Rules.The Sudoku board could be partia... 阅读全文
posted @ 2015-12-01 16:46 loadofleaf 阅读(288) 评论(0) 推荐(0)
摘要:题目来源https://leetcode.com/problems/search-insert-position/Given a sorted array and a target value, return the index if the target is found. If not, ret... 阅读全文
posted @ 2015-12-01 16:14 loadofleaf 阅读(205) 评论(0) 推荐(0)