随笔分类 -  Google

上一页 1 ··· 6 7 8 9 10
摘要:Find the contiguous subarray within an array (containing at least one number) which has the largest product. Example For example, given the array [2,3 阅读全文
posted @ 2016-07-01 05:44 北叶青藤 阅读(201) 评论(0) 推荐(0)
摘要:Flatten a binary tree to a fake "linked list" in pre-order traversal. Here we use the right pointer in TreeNode as the next pointer in ListNode. For e 阅读全文
posted @ 2016-07-01 02:31 北叶青藤 阅读(275) 评论(0) 推荐(0)
摘要:Intersection of Two Arrays Given two arrays, write a function to compute their intersection. Example Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], retur 阅读全文
posted @ 2016-06-30 12:50 北叶青藤 阅读(222) 评论(0) 推荐(0)
摘要:Given n non-negative integers representing the histogram's bar height where the width of each bar is 1, find the area of largest rectangle in the hist 阅读全文
posted @ 2016-06-30 12:11 北叶青藤 阅读(283) 评论(0) 推荐(0)
摘要:Word Search I 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 阅读全文
posted @ 2016-06-29 03:13 北叶青藤 阅读(313) 评论(0) 推荐(0)
摘要:Question: You are climbing a stair case. It takes n steps to reach to the top. Each time you can either climb 1 or 2 steps. In how many distinct ways 阅读全文
posted @ 2015-06-24 02:44 北叶青藤 阅读(148) 评论(0) 推荐(0)
摘要:Question: Find the longest sub-string without repeating characters. For example, if the given string is "abcdcefg", the longest sub-string is "dcefg". 阅读全文
posted @ 2015-01-26 05:50 北叶青藤 阅读(202) 评论(0) 推荐(0)
摘要:Word Break I Given a string s and a dictionary of words dict, determine if s can be segmented into a space-separated sequence of one or more dictionar 阅读全文
posted @ 2015-01-26 05:49 北叶青藤 阅读(249) 评论(0) 推荐(0)
摘要:Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack. The key part is i <= haystack.length() - nee 阅读全文
posted @ 2015-01-10 08:39 北叶青藤 阅读(123) 评论(0) 推荐(0)
摘要:Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases. For example,"A man, a plan, a canal: Pan 阅读全文
posted @ 2015-01-10 08:35 北叶青藤 阅读(158) 评论(0) 推荐(0)
摘要:The count-and-say sequence is the sequence of integers beginning as follows:1, 11, 21, 1211, 111221, ... 1 is read off as "one 1" or 11.11 is read off 阅读全文
posted @ 2015-01-10 08:31 北叶青藤 阅读(131) 评论(0) 推荐(0)
摘要:Write a function to find the longest common prefix string amongst an array of strings. For instance: ["ab", "bc"] returns ""; ["a", "ab"] re 阅读全文
posted @ 2015-01-06 09:32 北叶青藤 阅读(152) 评论(0) 推荐(0)
摘要:问题: 所谓 anagram, 就是两个词所用的字母及其个数都是一样的,但是,字母的位置不一样。比如 abcc 和 cbca 就是 anagram. 分析: 判断的方法比较简单,先把单个字母(字符)转成整数,然后利用了hashtable+计数器的原理进行判断。 转载请注明出处。 阅读全文
posted @ 2015-01-06 09:23 北叶青藤 阅读(905) 评论(0) 推荐(0)
摘要:Given a digit string, return all possible letter combinations that the number could represent. Example Given "23" Return ["ad", "ae", "af", "bd", "be" 阅读全文
posted @ 2015-01-02 07:26 北叶青藤 阅读(192) 评论(0) 推荐(0)
摘要:Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. For example, given n = 3, a solution set is: " 阅读全文
posted @ 2015-01-02 07:16 北叶青藤 阅读(191) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2015-01-02 06:30 北叶青藤 阅读(193) 评论(0) 推荐(0)
摘要:Subsets I Given a set of distinct integers, return all possible subsets. Notice Elements in a subset must be in non-descending order. The solution set 阅读全文
posted @ 2014-12-31 11:24 北叶青藤 阅读(354) 评论(0) 推荐(0)

上一页 1 ··· 6 7 8 9 10