随笔分类 -  Level 2

上一页 1 ··· 7 8 9 10 11 12 下一页
摘要:Given a binary tree, determine if it is height-balanced. For this problem, a height-balanced binary tree is defined as a binary tree in which the dept 阅读全文
posted @ 2016-07-08 04:05 北叶青藤 阅读(190) 评论(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 two strings, find the longest common subsequence (LCS). Your code should return the length of LCS. Example For "ABCD" and "EDCA", the LCS is "A" 阅读全文
posted @ 2016-07-06 12:51 北叶青藤 阅读(265) 评论(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)
摘要:For a given source string and a target string, you should output the first index(from 0) of target string in source string. If target does not exist i 阅读全文
posted @ 2016-07-06 08:27 北叶青藤 阅读(168) 评论(0) 推荐(0)
摘要:The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other. Given an integer n, return all 阅读全文
posted @ 2016-07-06 07:06 北叶青藤 阅读(173) 评论(0) 推荐(0)
摘要:Given a list of non negative integers, arrange them such that they form the largest number. Notice The result may be very large, so you need to return 阅读全文
posted @ 2016-07-05 09:48 北叶青藤 阅读(191) 评论(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)
摘要:Backpack | Given n items with size Ai, an integer m denotes the size of a backpack. How full you can fill this backpack? Given n items with size Ai, a 阅读全文
posted @ 2016-07-05 04:35 北叶青藤 阅读(225) 评论(0) 推荐(0)
摘要:Given an unsorted array of integers, find the length of the longest consecutive elements sequence. Clarification Your algorithm should run in O(n) com 阅读全文
posted @ 2016-07-05 01:48 北叶青藤 阅读(185) 评论(0) 推荐(0)
摘要:Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integers. 阅读全文
posted @ 2016-07-04 10:30 北叶青藤 阅读(216) 评论(0) 推荐(0)
摘要:3 Sum Given an array S of n integers, are there elements a, b, c in Ssuch that a + b + c = 0? Find all unique triplets in the array which gives the su 阅读全文
posted @ 2016-07-04 07:24 北叶青藤 阅读(239) 评论(0) 推荐(0)
摘要:Two Sum I 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 阅读全文
posted @ 2016-07-04 07:13 北叶青藤 阅读(326) 评论(0) 推荐(0)
摘要:Given a collection of distinct numbers, return all possible permutations. For example,[1,2,3] have the following permutations: [ [1,2,3], [1,3,2], [2, 阅读全文
posted @ 2016-07-04 05:29 北叶青藤 阅读(242) 评论(0) 推荐(0)
摘要:Given a singly linked list L: L0 → L1 → … → Ln-1 → Ln reorder it to: L0 → Ln → L1 → Ln-1 → L2 → Ln-2 → … Example Given 1->2->3->4->null, reorder it to 阅读全文
posted @ 2016-07-03 10:33 北叶青藤 阅读(174) 评论(0) 推荐(0)
摘要:A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null. Return a deep copy 阅读全文
posted @ 2016-07-03 06:55 北叶青藤 阅读(178) 评论(0) 推荐(0)
摘要:Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST. Example 2 1->2->3 => / \ 1 3 分析:非常简单,用递归 阅读全文
posted @ 2016-07-03 06:00 北叶青藤 阅读(252) 评论(0) 推荐(0)
摘要:Find the nth to last element of a singly linked list. The minimum number of nodes in list is n. Find the nth to last element of a singly linked list. 阅读全文
posted @ 2016-07-03 03:51 北叶青藤 阅读(219) 评论(0) 推荐(0)
摘要:Given a list, rotate the list to the right by k places, where k is non-negative. Given a list, rotate the list to the right by k places, where k is no 阅读全文
posted @ 2016-07-03 03:32 北叶青藤 阅读(143) 评论(0) 推荐(0)

上一页 1 ··· 7 8 9 10 11 12 下一页