上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 14 下一页

2013年10月31日

Chp3: Measuring and Modeling the Web

该文被密码保护。 阅读全文

posted @ 2013-10-31 12:36 Step-BY-Step 阅读(0) 评论(0) 推荐(0) 编辑

Chp2: Search Engine Basics

该文被密码保护。 阅读全文

posted @ 2013-10-31 05:32 Step-BY-Step 阅读(1) 评论(0) 推荐(0) 编辑

2013年10月24日

Searching a 2D Sorted Matrix Part I

摘要: Write an efficient algorithm that searches for a value in annxmtable (two-dimensional array). This table is sorted along the rows and columns — that is,Table[i][j] ≤ Table[i][j + 1],Table[i][j] ≤ Table[i + 1][j]Solution:1. STEP 方法:Start in the bottom-left corner of your matrix. Then go to the right 阅读全文

posted @ 2013-10-24 13:16 Step-BY-Step 阅读(320) 评论(0) 推荐(0) 编辑

Integer to Roman

摘要: Given an integer, convert it to a roman numeral.Input is guaranteed to be within the range from 1 to 3999.罗马数字共有7个,即I(1)、V(5)、X(10)、L(50)、C(100)、D(500... 阅读全文

posted @ 2013-10-24 02:14 Step-BY-Step 阅读(364) 评论(0) 推荐(0) 编辑

2013年10月23日

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 should be:bool isMatch(const char 阅读全文

posted @ 2013-10-23 08:08 Step-BY-Step 阅读(163) 评论(0) 推荐(0) 编辑

leetcode 整理

摘要: 1.Two Sum构造Comparator,KSum 这一类的问题最基本的一题, 解法:先sort,然后双指针,头尾各一个。进行加逼找值。对于其余的KSum最终是降次到2次。 如3Sum固定一个,然后找另外两个。 4Sum两两一组然后在对pair进行操作。2.Median of Two Sorted Arrays二分查找的应用。二分查找的结果肯定是start > end。注意分的两个区间是 start, mid -1 和 mid + 1, end。这里的话每次只能减少某个array长度的一半。3.Longest Substring Without Repeating Characters 阅读全文

posted @ 2013-10-23 03:06 Step-BY-Step 阅读(456) 评论(0) 推荐(0) 编辑

2013年10月22日

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 index1 and index2) are 阅读全文

posted @ 2013-10-22 14:51 Step-BY-Step 阅读(189) 评论(0) 推荐(0) 编辑

Interface Comparator

摘要: intcompare(To1, To2)Compares its two arguments for order. Returns a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.In the foregoing description, the notationsgn(expression)designates the mathematicalsignumfunction, whic... 阅读全文

posted @ 2013-10-22 14:35 Step-BY-Step 阅读(196) 评论(0) 推荐(0) 编辑

微软等公司数据结构+算法面试100题(第1-100题)首次完整亮相

摘要: 作者:July、2010年12月6日。更新:现今,这100题的答案已经全部整理出来了,微软面试100题2010年版全部答案集锦:http://blog.csdn.net/v_july_v/article/details/6870251。关于此100道面试题的所有一切详情,包括答案,资源下载,帖子维护,答案更新,都请参考此文:横空出世,席卷Csdn [评微软等数据结构+算法面试100题]。以下100题中有部分题目整理自何海涛的博客(http://zhedahht.blog.163.com/)。十分感谢。----------------------------------------------- 阅读全文

posted @ 2013-10-22 14:03 Step-BY-Step 阅读(270) 评论(0) 推荐(0) 编辑

从hadoop框架与MapReduce模式中谈海量数据处理

摘要: 转自:http://blog.csdn.net/v_july_v/article/details/6704077前言 几周前,当我最初听到,以致后来初次接触Hadoop与MapReduce这两个东西,我便稍显兴奋,觉得它们很是神秘,而神秘的东西常能勾起我的兴趣,在看过介绍它们的文章或论文之后,觉得Hadoop是一项富有趣味和挑战性的技术,且它还牵扯到了一个我更加感兴趣的话题:海量数据处理。 由此,最近凡是空闲时,便在看“Hadoop”,“MapReduce”“海量数据处理”这方面的论文。但在看论文的过程中,总觉得那些论文都是浅尝辄止,常常看的很不过瘾,总是一个东西刚要讲到紧要处,它便结束了,让 阅读全文

posted @ 2013-10-22 07:47 Step-BY-Step 阅读(204) 评论(0) 推荐(0) 编辑

Hadoop

摘要: The Apache™ Hadoop® project develops open-source software for reliable, scalable, distributed computing.The Apache Hadoop software library is a framework that allows for the distributed processing of large data sets across clusters of computers using simple programming models. It is designed to 阅读全文

posted @ 2013-10-22 06:43 Step-BY-Step 阅读(470) 评论(0) 推荐(0) 编辑

2013年10月18日

Clone Graph

摘要: Clone an undirected graph. Each node in the graph contains alabeland a list of itsneighbors.OJ's undirected graph serialization:Nodes are labeled uniquely.We use#as a separator for each node, and,as a separator for node label and each neighbor of the node.As an example, consider the serialized g 阅读全文

posted @ 2013-10-18 07:57 Step-BY-Step 阅读(169) 评论(0) 推荐(0) 编辑

Gas Station

摘要: There areNgas stations along a circular route, where the amount of gas at stationiisgas[i].You have a car with an unlimited gas tank and it costscost[i]of gas to travel from stationito its next station (i+1). You begin the journey with an empty tank at one of the gas stations.Return the starting gas 阅读全文

posted @ 2013-10-18 07:20 Step-BY-Step 阅读(213) 评论(0) 推荐(0) 编辑

2013年10月17日

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 fo... 阅读全文

posted @ 2013-10-17 14:51 Step-BY-Step 阅读(229) 评论(0) 推荐(0) 编辑

String to Integer (atoi)

摘要: Implementatoito convert a string to an integer.Hint:Carefully consider all possible input cases. If you want a challenge, please do not see below and ... 阅读全文

posted @ 2013-10-17 14:22 Step-BY-Step 阅读(206) 评论(0) 推荐(0) 编辑

Palindrome Number

摘要: Determine whether an integer is a palindrome. Do this without extra space.click to show spoilers.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 integer. Howe 阅读全文

posted @ 2013-10-17 13:49 Step-BY-Step 阅读(136) 评论(0) 推荐(0) 编辑

Container With Most Water

摘要: Givennnon-negative integersa1,a2, ...,an, where each represents a point at coordinate (i,ai).nvertical lines are drawn such that the two endpoints of lineiis at (i,ai) and (i, 0). Find two lines, which together with x-axis forms a container, such that the container contains the most water.Note: You 阅读全文

posted @ 2013-10-17 12:31 Step-BY-Step 阅读(126) 评论(0) 推荐(0) 编辑

Longest Common Prefix

摘要: Write a function to find the longest common prefix string amongst an array of strings.一个个比就行了,找到最长的匹配子串。 1 public class Solution { 2 public String longestCommonPrefix(String[] strs) { 3 // Note: The Solution object is instantiated only once and is reused by each test case. 4 if(s... 阅读全文

posted @ 2013-10-17 12:27 Step-BY-Step 阅读(147) 评论(0) 推荐(0) 编辑

求和问题总结(leetcode 2Sum, 3Sum, 4Sum, K Sum)

摘要: 转自 http://tech-wonderland.net/blog/summary-of-ksum-problems.html前言:做过leetcode的人都知道, 里面有2sum, 3sum(closest), 4sum等问题, 这些也是面试里面经典的问题, 考察是否能够合理利用排序这个性质, 一步一步得到高效的算法. 经过总结, 本人觉得这些问题都可以使用一个通用的K sum求和问题加以概括消化, 这里我们先直接给出K Sum的问题描述和算法(递归解法), 然后将这个一般性的方法套用到具体的K, 比如leetcode中的2Sum, 3Sum, 4Sum问题. 同时我们也给出另一种哈希算法 阅读全文

posted @ 2013-10-17 11:59 Step-BY-Step 阅读(507) 评论(0) 推荐(0) 编辑

4Sum

摘要: Given an arraySofnintegers, are there elementsa,b,c, anddinSsuch thata+b+c+d= target? Find all unique quadruplets in the array which gives the sum of target.Note:Elements in a quadruplet (a,b,c,d) must be in non-descending order. (ie,a≤b≤c≤d)The solution set must not contain duplicate quadruplets. . 阅读全文

posted @ 2013-10-17 11:58 Step-BY-Step 阅读(161) 评论(0) 推荐(0) 编辑

3Sum Closest

摘要: Given an arraySofnintegers, find three integers inSsuch that the sum is closest to a given number, target. Return the sum of the three integers. You may assume that each input would have exactly one solution. For example, given array S = {-1 2 1 -4}, and target = 1. The sum that is closest to ... 阅读全文

posted @ 2013-10-17 11:47 Step-BY-Step 阅读(162) 评论(0) 推荐(0) 编辑

2013年10月16日

3Sum

摘要: Given an arraySofnintegers, are there elementsa,b,cinSsuch thata+b+c= 0? Find all unique triplets in the array which gives the sum of zero.Note:Elements in a triplet (a,b,c) must be in non-descending order. (ie,a≤b≤c)The solution set must not contain duplicate triplets. For example, given array S... 阅读全文

posted @ 2013-10-16 13:45 Step-BY-Step 阅读(146) 评论(0) 推荐(0) 编辑

Letter Combinations of a Phone Number

摘要: Given a digit string, return all possible letter combinations that the number could represent.A mapping of digit to letters (just like on the telephone buttons) is given below.Input:Digit string "23"Output: ["ad", "ae", "af", "bd", "be", &q 阅读全文

posted @ 2013-10-16 08:06 Step-BY-Step 阅读(303) 评论(0) 推荐(0) 编辑

Remove Nth Node From End of List

摘要: Given a linked list, remove thenthnode from the end of list and return its head.For example, Given linked list: 1->2->3->4->5, and n = 2. After removing the second node from the end, the linked list becomes 1->2->3->5.Note:Givennwill always be valid.Try to do this in one pass.也可 阅读全文

posted @ 2013-10-16 08:05 Step-BY-Step 阅读(153) 评论(0) 推荐(0) 编辑

Valid Parentheses

摘要: Given a string containing just the characters'(',')','{','}','['and']', determine if the input string is valid.The brackets must close in the correct order,"()"and"()[]{}"are all valid but"(]"and"([)]"are not. 1 阅读全文

posted @ 2013-10-16 08:03 Step-BY-Step 阅读(144) 评论(0) 推荐(0) 编辑

Generate Parentheses

摘要: Givennpairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, givenn= 3, a solution set is:"((()))... 阅读全文

posted @ 2013-10-16 07:47 Step-BY-Step 阅读(142) 评论(0) 推荐(0) 编辑

Merge k Sorted Lists

摘要: Mergeksorted linked lists and return it as one sorted list. Analyze and describe its complexity. 1 public class Solution { 2 public ListNode mergeKLists(ArrayList lists) { 3 // Start typing your Java solution below 4 // DO NOT write main() function 5 if(lists.size()==0) r... 阅读全文

posted @ 2013-10-16 07:28 Step-BY-Step 阅读(135) 评论(0) 推荐(0) 编辑

Combination Sum II

摘要: Given a collection of candidate numbers (C) and a target number (T), find all unique combinations inCwhere the candidate numbers sums toT.Each number ... 阅读全文

posted @ 2013-10-16 03:31 Step-BY-Step 阅读(192) 评论(0) 推荐(0) 编辑

Swap Nodes in Pairs

摘要: Given a linked list, swap every two adjacent nodes and return its head.For example,Given1->2->3->4, you should return the list as2->1->4->3.Your algorithm should use only constant space. You maynotmodify the values in the list, only nodes itself can be changed. 1 public class Solut 阅读全文

posted @ 2013-10-16 01:31 Step-BY-Step 阅读(179) 评论(0) 推荐(0) 编辑

2013年10月15日

Reverse Nodes in k-Group

摘要: Given a linked list, reverse the nodes of a linked listkat a time and return its modified list.If the number of nodes is not a multiple ofkthen left-o... 阅读全文

posted @ 2013-10-15 14:02 Step-BY-Step 阅读(188) 评论(0) 推荐(0) 编辑

Remove Duplicates from Sorted Array

摘要: Given a sorted array, remove the duplicates in place such that each element appear onlyonceand return the new length.Do not allocate extra space for another array, you must do this in place with constant memory.For example,Given input array A =[1,1,2],Your function should return length =2, and A is 阅读全文

posted @ 2013-10-15 14:01 Step-BY-Step 阅读(123) 评论(0) 推荐(0) 编辑

Remove Element

摘要: Given an array and a value, remove all instances of that value in place and return the new length.The order of elements can be changed. It doesn't matter what you leave beyond the new length. 1 public class Solution { 2 public int removeElement(int[] A, int elem) { 3 // Note: The Solutio... 阅读全文

posted @ 2013-10-15 13:38 Step-BY-Step 阅读(108) 评论(0) 推荐(0) 编辑

Implement strStr()

摘要: Returns a pointer to the first occurrence of needle in haystack, ornullif needle is not part of haystack.如果当前不是子串则回溯。时间复杂度是O(mn)。 1 public class Solut... 阅读全文

posted @ 2013-10-15 12:59 Step-BY-Step 阅读(406) 评论(0) 推荐(0) 编辑

Divide Two Integers

摘要: Divide two integers without using multiplication, division and mod operator.如果可以用乘的话,二分搜索倒是不错的解法。否则,只能寄希望于位符操作了。基本思想就是把除数向左移位(×2)然后与被除数比较,直到发现仅次于被除数的那... 阅读全文

posted @ 2013-10-15 07:15 Step-BY-Step 阅读(746) 评论(0) 推荐(0) 编辑

2013年10月13日

Longest Valid Parentheses

摘要: Given a string containing just the characters'('and')', find the length of the longest valid (well-formed) parentheses substring.For"(()", the longest... 阅读全文

posted @ 2013-10-13 09:07 Step-BY-Step 阅读(210) 评论(0) 推荐(0) 编辑

Sudoku Solver

摘要: Write a program to solve a Sudoku puzzle by filling the empty cells.Empty cells are indicated by the character'.'.You may assume that there will be on... 阅读全文

posted @ 2013-10-13 08:07 Step-BY-Step 阅读(332) 评论(0) 推荐(0) 编辑

Valid Sudoku

摘要: 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 ... 阅读全文

posted @ 2013-10-13 07:40 Step-BY-Step 阅读(123) 评论(0) 推荐(0) 编辑

Search in Rotated Sorted Array

摘要: Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e.,0 1 2 4 5 6 7might become4 5 6 7 0 1 2).You are given a target value to search. If found in the array return its index, otherwise return -1.You may assume no duplicate exists in the array.两次二分,一次找到rotate的位置,一次找target。就是说 阅读全文

posted @ 2013-10-13 02:42 Step-BY-Step 阅读(251) 评论(0) 推荐(0) 编辑

2013年10月12日

Search for a Range

摘要: Given a sorted array of integers, find the starting and ending position of a given target value.Your algorithm's runtime complexity must be in the ord... 阅读全文

posted @ 2013-10-12 14:08 Step-BY-Step 阅读(149) 评论(0) 推荐(0) 编辑

Search Insert Position

摘要: Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.You may assume no duplicates in the array.Here are few examples.[1,3,5,6], 5 → 2[1,3,5,6], 2 → 1[1,3,5,6], 7 → 4[1,3,5,6], 0 → 0 1 public class So 阅读全文

posted @ 2013-10-12 12:55 Step-BY-Step 阅读(142) 评论(0) 推荐(0) 编辑

上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 14 下一页

导航