12 2014 档案
摘要:Given a collection of integers that might contain duplicates,S, return all possible subsets.Note:Elements in a subset must be in non-descending order....
阅读全文
摘要:今天开始,回溯法强化阶段。Given a 2D board and a word, find if the word exists in the grid.The word can be constructed from letters of sequentially adjacent cell, ...
阅读全文
摘要:原本的目的是想模拟一个流的上传过程,就是一边生成数据,一边存储数据,因为能用上HADOOP通常情况下原本数据的大小就大到本地硬盘存不下。这一般是通过把数据先一部分一部分的缓冲到本地的某个文件夹下,hdfs把缓冲文件夹中的文件一点一点上传,并把上传了的缓冲文件删除。 我这里没有实现数据的分次生成...
阅读全文
摘要:Given a strings, partitionssuch that every substring of the partition is a palindrome.Return the minimum cuts needed for a palindrome partitioning ofs...
阅读全文
摘要:Hadoop2.6.0的所有Java API都在http://hadoop.apache.org/docs/r2.6.0/api/overview-summary.html里。下面实现一个利用Java API创建HDFS文件的例子。参照《实践Hadoop》(刘鹏) 书中的第50页。利用FileSys...
阅读全文
摘要:之前跑了一下hadoop里面自带的例子,现在顺一下如何通过源代码来运行程序。我懒得装eclipse,就全部用命令行了。整体参考官网上的:http://hadoop.apache.org/docs/r2.6.0/hadoop-mapreduce-client/hadoop-mapreduce-clie...
阅读全文
摘要:想自己走一遍从代码到运行的流程,结果各种错,郁闷啊。问题①http://localhost:50070/ 里面一进去就告诉我块丢了....解决:bin/hadoop fsck -delete删除所有有问题的内容
阅读全文
摘要:参考了http://www.cnblogs.com/howard-queen/archive/2012/01/30/2331795.html第一步:用vim先写一个java程序 first.java 就写在jdk的bin目录下public class first{ public stati...
阅读全文
摘要:网络层:讨论的是如何把多个网络通过路由器互联成一个互联网络。负责主机到主机的通信服务。它提供的服务是不可靠的,也就是说网络只管传输,不管传输的过程中会不会出错,这些错误处理由主机来负责。IP协议:我们可以连一个一个比较小的网络,可是网络有各种各样的,比如说无线网络、有线网络等等。这些网络怎么通信呢?...
阅读全文
摘要:Given a stringSand a stringT, count the number of distinct subsequences ofTinS.A subsequence of a string is a new string which is formed from the orig...
阅读全文
摘要:Given two wordsword1andword2, find the minimum number of steps required to convertword1toword2. (each operation is counted as 1 step.)You have the fol...
阅读全文
摘要:Givens1,s2,s3, find whethers3is formed by the interleaving ofs1ands2.For example,Given:s1="aabcc",s2="dbbca",Whens3="aadbbcbcac", return true.Whens3="...
阅读全文
摘要:Implement regular expression matching with support for'.'and'*'.'.' Matches any single character.'*' Matches zero or more of the preceding element.The...
阅读全文
摘要:Implement wildcard pattern matching with support for'?'and'*'.'?' Matches any single character.'*' Matches any sequence of characters (including the e...
阅读全文
摘要:Given a string containing just the characters'('and')', find the length of the longest valid (well-formed) parentheses substring.For"(()", the longest...
阅读全文
摘要:Given a strings1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursively.Below is one possible representation...
阅读全文
摘要:Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing all ones and return its area.找到01矩形中最大的全1子矩阵。我自己的思路: 我先用一个跟输...
阅读全文
摘要:Find the contiguous subarray within an array (containing at least one number) which has the largest product.For example, given the array[2,3,-2,4],the...
阅读全文
摘要:咱看书没有顺序,喜欢哪里看哪里,so,先看跟我平时使用网络最相关的应用层~域名与url 域名是IP的别名,比如www.baidu.com,其中越靠后的就越表示域名等级越高,com是顶级域名,baidu是二级域名,但是www是不是三级域名我就搞不懂了.还有,一个域名对应一个ip,那这么多信息都放在一...
阅读全文
摘要:Given amxngrid filled with non-negative numbers, find a path from top left to bottom right whichminimizesthe sum of all numbers along its path.Note:Yo...
阅读全文
摘要:Givenn, generate all structurally uniqueBST's(binary search trees) that store values 1...n.For example,Givenn= 3, your program should return all 5 uni...
阅读全文
摘要:Givenn, how many structurally uniqueBST's(binary search trees) that store values 1...n?For example,Givenn= 3, there are a total of 5 unique BST's. 1 ...
阅读全文
摘要:Follow up for "Unique Paths":Now consider if some obstacles are added to the grids. How many unique paths would there be?An obstacle and empty space i...
阅读全文
摘要:A robot is located at the top-left corner of amxngrid (marked 'Start' in the diagram below).The robot can only move either down or right at any point ...
阅读全文
摘要:Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below.For example, given the fol...
阅读全文
摘要:由于下载的是hadoop的最新版,网上各种杂七杂八的东西都不适用。好在官网上说的也够清楚了。如果有人看这篇文章的话,最大的忠告就是看官网。官网2.6.0的安装教程:http://hadoop.apache.org/docs/r2.6.0/hadoop-project-dist/hadoop-comm...
阅读全文
摘要:1、输入ssh-keygen -t dsa -P '' -f ~/.ssh/id_dsa其中''里的是登陆的密码,因为要设置免密码,所以''里是什么都没有的,空格也不行2、输入 cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys3、输入 ssh -vers...
阅读全文
摘要:1、在http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html下载最新版的rpm文件,我的是x86系统就下图中的第一个下载后拖到linux虚拟机里。2、运行 rpm -ivh jdk-8u2...
阅读全文
摘要:鸟哥 22章内容单个源代码编译运行设有一个hello.c 可以用下面方式运行 生成可执行文件a.out[localhost scripts]$ gcc hello.c [localhost scripts]$ ll hello.c a.out[localhost scripts]$ ./a.outH...
阅读全文
摘要:A message containing letters fromA-Zis being encoded to numbers using the following mapping:'A' -> 1'B' -> 2...'Z' -> 26Given an encoded message conta...
阅读全文
摘要:虽然题目中说是easy, 但是我提交了10遍才过,就算hard吧。主要是很多情况我都没有考虑到。并且有的时候我的规则和答案中的规则不同。答案的规则:1.前导空格全部跳过 “ 123” = 1232.正负号要考虑 “+123” = 123 “-123” = -1233.数字的前导0要跳过 “-0...
阅读全文
摘要:There areNchildren standing in a line. Each child is assigned a rating value.You are giving candies to these children subjected to the following requi...
阅读全文
摘要:You are given a string,S, and a list of words,L, that are all of the same length. Find all starting indices of substring(s) in S that is a concatenati...
阅读全文