随笔分类 -  Google

上一页 1 ··· 4 5 6 7 8 9 10 下一页
摘要:Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along the shortest path from the root node down to the nearest l 阅读全文
posted @ 2016-07-08 11:30 北叶青藤 阅读(152) 评论(0) 推荐(0)
摘要:Given a binary tree, determine if it is a valid binary search tree (BST). Assume a BST is defined as follows: The left subtree of a node contains only 阅读全文
posted @ 2016-07-08 10:29 北叶青藤 阅读(169) 评论(0) 推荐(0)
摘要:Given a binary tree, find the maximum path sum. The path may start and end at any node in the tree. Example Given the below binary tree: 1 / \ 2 3 ret 阅读全文
posted @ 2016-07-08 10:19 北叶青藤 阅读(230) 评论(0) 推荐(0)
摘要:Given the root and two nodes in a Binary Tree. Find the lowest common ancestor(LCA) of the two nodes. The lowest common ancestor is the node with larg 阅读全文
posted @ 2016-07-08 02:55 北叶青藤 阅读(238) 评论(0) 推荐(0)
摘要:Design an iterator over a binary search tree with the following rules: Elements are visited in ascending order (i.e. an in-order traversal) next() and 阅读全文
posted @ 2016-07-08 02:39 北叶青藤 阅读(171) 评论(0) 推荐(0)
摘要:Given a sequence of integers, find the longest increasing subsequence (LIS). You code should return the length of the LIS. Clarification What's the de 阅读全文
posted @ 2016-07-08 00:58 北叶青藤 阅读(245) 评论(0) 推荐(0)
摘要:Given inorder and postorder traversal of a tree, construct the binary tree. Notice You may assume that duplicates do not exist in the tree. Given inor 阅读全文
posted @ 2016-07-08 00:21 北叶青藤 阅读(220) 评论(0) 推荐(0)
摘要:Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level). Example Given binary tree {3,9,2 阅读全文
posted @ 2016-07-07 12:30 北叶青藤 阅读(139) 评论(0) 推荐(0)
摘要:Reverse Words in a String I Given an input string, reverse the string word by word. For example,Given s = "the sky is blue",return "blue is sky the". 阅读全文
posted @ 2016-07-06 12:01 北叶青藤 阅读(178) 评论(0) 推荐(0)
摘要:Maximum Subarray Given an array of integers, find a contiguous subarray which has the largest sum. Notice The subarray should contain at least one num 阅读全文
posted @ 2016-07-06 11:10 北叶青藤 阅读(216) 评论(0) 推荐(0)
摘要:Search a 2D Matrix II Write an efficient algorithm that searches for a value in an m x n matrix, return the occurrence of it. This matrix has the foll 阅读全文
posted @ 2016-07-06 10:43 北叶青藤 阅读(211) 评论(0) 推荐(0)
摘要:Given a string and an offset, rotate string by offset. (rotate from left to right) Given a string and an offset, rotate string by offset. (rotate from 阅读全文
posted @ 2016-07-06 08:21 北叶青藤 阅读(234) 评论(0) 推荐(0)
摘要:Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. Example Given lists: [ 2->4->null, null, -1->null ] 阅读全文
posted @ 2016-07-06 07:22 北叶青藤 阅读(173) 评论(0) 推荐(0)
摘要:For an array A, if i < j, and A [i] > A [j], called (A [i], A [j]) is a reverse pair.return total of reverse pairs in A. For an array A, if i < j, and 阅读全文
posted @ 2016-07-06 02:01 北叶青藤 阅读(220) 评论(0) 推荐(0)
摘要:Swap Nodes | Given a linked list, swap every two adjacent nodes and return its head. Example Given 1->2->3->4, you should return the list as 2->1->4-> 阅读全文
posted @ 2016-07-05 12:24 北叶青藤 阅读(191) 评论(0) 推荐(0)
摘要:Best Time to Buy and Sell Stock I Say you have an array for which the ith element is the price of a given stock on day i. If you were only permitted t 阅读全文
posted @ 2016-07-05 09:14 北叶青藤 阅读(238) 评论(0) 推荐(0)
摘要: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 or 阅读全文
posted @ 2016-07-05 09:02 北叶青藤 阅读(200) 评论(0) 推荐(0)
摘要:There are two sorted arrays A and B of size m and nrespectively. Find the median of the two sorted arrays. There are two sorted arrays A and B of size 阅读全文
posted @ 2016-07-05 07:55 北叶青藤 阅读(206) 评论(0) 推荐(0)
摘要:Design an algorithm and write code to serialize and deserialize a binary tree. Writing the tree to a file is called 'serialization' and reading back f 阅读全文
posted @ 2016-07-05 06:06 北叶青藤 阅读(178) 评论(0) 推荐(0)
摘要:Combination Sum | Given a set of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to  阅读全文
posted @ 2016-07-05 04:46 北叶青藤 阅读(251) 评论(0) 推荐(0)

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