- 博客(99)
- 资源 (2)
- 收藏
- 关注
原创 Unique Paths - LeetCode 62
题目描述:A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below).The robot can only move either down or right at any point in time. The robot is trying to r
2015-05-07 20:14:41 283
原创 Best Time to Buy and Sell Stock II - LeetCode 4
题目描述:Say you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may complete as many transactions as you like
2015-05-07 19:20:49 306
原创 Factorial Trailing Zeroes - LeetCode 172
LeetCode上面的一道数学题:Given an integer n, return the number of trailing zeroes in n!. Note: Your solution should be in logarithmic time complexity. 初看题目,要求n的阶乘结果中末尾有多少个0,于是想到将结果分解成质因子相乘,一对2
2015-04-28 22:24:03 345
原创 Plus One - LeetCode 66
题目描述:Given a non-negative number represented as an array of digits, plus one to the number.The digits are stored such that the most significant digit is at the head of the list.分析:此题是将一个非负整数用一
2015-04-28 22:21:59 402
原创 Valid Sudoku - LeetCode 36
题目描述:Determine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules.The Sudoku board could be partially filled, where empty cells are filled with the character '.'.A partially
2015-04-28 22:18:36 390
原创 Compare Version Numbers- LeetCode 165
题目描述:Compare two version numbers version1 and version2.If version1 > version2 return 1, if version1 version2 return -1, otherwise return 0.You may assume that the version strings are non-e
2015-04-28 22:08:14 301
原创 Spark完全分布式集群安装
前言:本篇文章是学习spark的开篇,搭建一个spark的完全分布式集群,与大家共勉。本次安装是之前的hadoop完全分布式集群的基础之上进行,相关软件版本如下: Linux系统:CentOS release 6.5 final x86-64 Jdk:jdk1.7.0_71 hadoop: Yarn的hadoop2.4.1 scala:scala-2.
2015-04-28 21:50:34 2358
原创 2015上机笔试题-火星计算器
题目描述:自定义运算符 @,#,$,&,并且优先级@>#>$>&,利用下面的计算法则,计算出一个给定的字符串表示的表达式的值,返回整型结果。x@y = (x-1)*(y+1);x#y = (2*x+5)*(3*y+60)x$y = (x+1)*(2*x+3)*(y-1)*(2*y-3)x&y = ((x+y+1)*(y-9)+(x+7)/(y-8))输入:接受多行输
2015-04-27 20:38:19 494
原创 Excel Sheet Column Title - LeetCode 168
题目描述:Given a positive integer, return its corresponding column title as appear in an Excel sheet.For example: 1 -> A 2 -> B 3 -> C ... 26 -> Z 27 -> AA 28 -> AB 分析
2015-04-24 22:11:43 336
原创 Excel Sheet Column Number - LeetCode 171
题目描述:Related to question Excel Sheet Column TitleGiven a column title as appear in an Excel sheet, return its corresponding column number.For example: A -> 1 B -> 2 C -> 3
2015-04-24 22:08:15 332
原创 House Robber - LeetCode 198
题目描述:You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjac
2015-04-24 22:07:02 431
原创 Add Binary - LeetCode 67
题目描述:Given two binary strings, return their sum (also a binary string).For example,a = "11"b = "1"Return "100".分析:该题类似于大整数的加法,要求将字符串形式的二进制数相加,返回二进制结果。需注意:当两个字符串长度不一样时,需将长度较小的那个首部添加0,
2015-04-24 22:05:03 403
原创 Longest Common Prefix - LeetCode 14
题目描述:Write a function to find the longest common prefix string amongst an array of strings.分析:要求所以字符串中的最长相同前缀字符串,只需遍历一次字符串数组,不断迭代更新当前的最长相同前缀字符串即可。设置一个字符串变量prefix,保存当前的最长相同前缀,若字符串数组为空,则返回空串
2015-04-24 22:03:08 370
原创 Find Minimum in Rotated Sorted Array - LeetCode 153
题目描述:Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).Find the minimum element.You may assume no duplicate exists
2015-04-24 21:50:53 368
原创 2015笔试上机题--求员工就餐最大享受度
已知某公司有n个食堂,第i个食堂有m[i]种食物(1(注意,该员工有个挑食的特点,同一种食物他最多点一份。)现告诉你所有食堂食物的信息,希望你进行选择搭配,使得该员工获得最大享受度,并输出这个享受度的值。Input第一行是一个正整数T(1对于每组数据——第一行是三个数n,bot,top,n 代表食堂数目,n属于[1,10],bot和top分别是是这次
2015-04-24 21:46:01 459
原创 3Sum - LeetCode 15
题目描述 :Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.Note:Elements in a triplet
2015-04-24 21:15:51 371
原创 2015笔试上机题-- 求01串的最小交换次数
题目描述:给定一个01串(仅由 ‘0’或‘1’组成的字符串),现在把这个数字串排序成“非递减系列”,请问至少需要多少次交换(任意两个位置交换)?Input输入数据第一行是一个正整数T(T接下来的T行,每行给出一个01串。数据包装——50%的字符串长度在[1,100]之间;95%的字符串长度在[1,10000];100%的字符串长度在[1,1000
2015-04-24 20:33:20 3223
原创 hadoop完全分布式集群搭建
算起来接触hadoop集群也有一段时间了,只是以前硬件条件有限,玩儿都是伪分布式。最近有了新服务器,应项目需求,完成了hadoop完全分布式的搭建,以下是具体过程。这是个人实践操作后的记录,欢迎各位阁下不吝赐教。好了不废话了,赶紧进入正题,过程有点长。硬件条件:多台相同linux系统主机,要求所有机器在同一网段。主机分别命名为quad1,quad2,…quadn,其中quad1作为主节
2015-04-24 10:11:32 3841
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人