程序员的世界, 为程序员服务

2016-06-29
根据输入路径产生输出路径和清除HDFS目录

##一、实验内容对HDFS输入目录的路径解析出来,组成输出路径,这在业务上是十分常用的。这里其实是没有多文件名输出,仅仅是调用了MultipleOutputs的addNamedOutput方法一次,设置文件名为result. 同时为了保证计算的可重入性,每次都需要将已经存在的输出目录删除。

Read More

2016-06-29
使用HashPartitioner来调节Reducer的计算负载

##一、实验内容本节介绍如何使用HashPartitioner将Mapper的输出按照key进行分组后交给Reducer来处理。合理的分组策略将使得每个Reducer获得的计算负载差距不大,从而整体reduce的性能更加均衡。

Read More

2016-06-29
从《琅琊榜》来看大数据

最近看完《琅琊榜》这不热播剧后,真心感觉其是一部国产的良心之作,完美的剧情,外加杠杠的特效,使得我这个不经常看电视剧的人也能追着看完。 通过整个剧的回顾,我们可以惊奇的发现:人称麒麟才子的梅长苏就是一个大数据的专家先驱有木有,琅琊阁就是一个数据中心有木有!

Read More

2016-06-29
LeetCode-Add and Search Word - Data structure design

##题目 ####Add and Search Word - Data structure design Design a data structure that supports the following two operations: void addWord(word) bool search(word) search(word) can search a literal word or a regular expression string containing only letters a-z or .. A . means it can represent any one le

Read More

2016-06-29
MarkDown使用

##引言MarkDown的目标是实现易读易写。它用来作为一种网络内容的写作语言。但是我们不是要用它来取代HTML,而是它能让文档更容易阅读、编写。 参考图灵社区MarkDown语言说明(详解版)。

Read More

2016-06-29
LeetCode-TwoSum

题目Two Sum Given an array of integers, find two numbers such that they add up to a specific target number. The function twoSum should return indices of the two numbers such that they add up to the target, where index1 must be less than index2. Please note that your returned answers (both inde

Read More

2016-06-29
LeetCode-ZigZag Conversion

##题目 ####ZigZag Conversion The string PAYPALISHIRING is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility) P A H N A P L S I I G Y I R And then read line by line: PAHNAPLSIIGYIRWrite the c

Read More

2016-06-29
LeetCode-String to Integer (atoi)

##题目 ####String to Integer (atoi) Implement atoi to convert a string to an integer. Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself what are the possible input cases. Notes: It is intended for this problem to be specified vaguely

Read More

2016-06-29
LeetCode-Roman to Integer

##题目 ####Roman to Integer Given a roman numeral, convert it to an integer. Input is guaranteed to be within the range from 1 to 3999.

Read More

2016-06-29
LeetCode-Word Ladder

##题目 ####Word Ladder Given two words (start and end), and a dictionary, find the length of shortest transformation sequence from start to end, such that: 1.Only one letter can be changed at a time2.Each intermediate word must exist in the dictionaryFor example, Given:start = "hit"end = &q

Read More

2016-06-29
LeetCode-Regular Expression Matching

##题目 ####Regular Expression Matching Implement regular expression matching with support for ‘.’ and ‘*’. '.' Matches any single character. '*' Matches zero or more of the preceding element. The matching should cover the entire input string (not partial). The function prototype

Read More

2016-06-29
LeetCode-Reverse Integer

##题目 ####Reverse Integer Reverse digits of an integer. Example1: x = 123, return 321 Example2: x = -123, return -321 ####Have you thought about this?Here are some good questions to ask before coding. Bonus points for you if you have already thought through this! If the integer’s last digit is 0, wh

Read More

2016-06-29
LeetCode-Palindrome Number

##题目 ####Palindrome Number Determine whether an integer is a palindrome. Do this without extra space. ####Some hints:Could negative integers be palindromes? (ie, -1) If you are thinking of converting the integer to string, note the restriction of using extra space. You could also try reversing an i

Read More

2016-06-29
LeetCode-Median of Two Sorted Arrays

##题目 ####Median of Two Sorted Arrays There are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log(m+n)).

Read More

2016-06-29
LeetCode-Longest Common Prefix

##题目 ####Longest Common Prefix Write a function to find the longest common prefix string amongst an array of strings.

Read More

2016-06-29
LeetCode-Longest Substring Without Repeating Characters

##题目 ####Longest Substring Without Repeating Characters Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters for “abcabcbb” is “abc”, which the length is 3. For “bbbbb” the longest substring is “b”, with

Read More

2016-06-29
LeetCode-Longest Palindromic Substring

##题目 ####Longest Palindromic Substring Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists one unique longest palindromic substring.

Read More

2016-06-29
LeetCode-Integer to Roman

##题目 ####Integer to Roman Given an integer, convert it to a roman numeral. Input is guaranteed to be within the range from 1 to 3999.

Read More

2016-06-29
LeetCode-Container With Most Water

##题目 ####Container With Most Water Given n non-negative integers a1, a2, …, an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at (i, ai) and (i, 0). Find two lines, which together with x-axis forms a container, such that the

Read More

2016-06-29
LeetCode-Word Search II

##题目 ####Word Search II Given a 2D board and a list of words from the dictionary, find all words in the board. Each word must be constructed from letters of sequentially adjacent cell, where “adjacent” cells are those horizontally or vertically neighboring. The same letter cell may not be used mor

Read More