随笔分类 -  leetcode

1 2 3 4 5 ··· 11 下一页
摘要:You have a number of envelopes with widths and heights given as a pair of integers (w, h). One envelope can fit into another if and only if both the w 阅读全文
posted @ 2017-06-04 09:41 CodesKiller 阅读(194) 评论(0) 推荐(0)
摘要:Given a n x n matrix where each of the rows and columns are sorted in ascending order, find the kth smallest element in the matrix. Note that it is th 阅读全文
posted @ 2017-06-04 08:30 CodesKiller 阅读(187) 评论(0) 推荐(0)
摘要:Given an unsorted array of integers, find the length of longest increasing subsequence. For example,Given [10, 9, 2, 5, 3, 7, 101, 18],The longest inc 阅读全文
posted @ 2017-06-03 07:03 CodesKiller 阅读(107) 评论(0) 推荐(0)
摘要:Implement pow(x, n). 阅读全文
posted @ 2017-05-27 02:58 CodesKiller 阅读(138) 评论(0) 推荐(0)
摘要:Given an array of n distinct non-empty strings, you need to generate minimal possible abbreviations for every word following rules below. Example: Not 阅读全文
posted @ 2017-05-26 07:18 CodesKiller 阅读(284) 评论(0) 推荐(0)
摘要:Given a string and a string dictionary, find the longest string in the dictionary that can be formed by deleting some characters of the given string. 阅读全文
posted @ 2017-05-26 02:46 CodesKiller 阅读(184) 评论(0) 推荐(0)
摘要:Given an array of citations (each citation is a non-negative integer) of a researcher, write a function to compute the researcher's h-index. According 阅读全文
posted @ 2017-05-25 08:54 CodesKiller 阅读(196) 评论(0) 推荐(0)
摘要:A group of two or more people wants to meet and minimize the total travel distance. You are given a 2D grid of values 0 or 1, where each 1 marks the h 阅读全文
posted @ 2017-05-25 00:55 CodesKiller 阅读(198) 评论(0) 推荐(0)
摘要:Given an unsorted array, find the maximum difference between the successive elements in its sorted form. Try to solve it in linear time/space. Return 阅读全文
posted @ 2017-05-20 02:42 CodesKiller 阅读(146) 评论(0) 推荐(0)
摘要:Given a list of non negative integers, arrange them such that they form the largest number. For example, given [3, 30, 34, 5, 9], the largest formed n 阅读全文
posted @ 2017-05-20 00:56 CodesKiller 阅读(122) 评论(0) 推荐(0)
摘要:Given a binary search tree and a node in it, find the in-order successor of that node in the BST. Note: If the given node has no in-order successor in 阅读全文
posted @ 2017-03-24 11:35 CodesKiller 阅读(172) 评论(0) 推荐(0)
摘要:Given a complete binary tree, count the number of nodes. Definition of a complete binary tree from Wikipedia:In a complete binary tree every level, ex 阅读全文
posted @ 2017-03-24 08:39 CodesKiller 阅读(168) 评论(0) 推荐(0)
摘要:Given a non-empty binary search tree and a target value, find the value in the BST that is closest to the target. Note: Given target value is a floati 阅读全文
posted @ 2017-03-24 07:13 CodesKiller 阅读(130) 评论(0) 推荐(0)
摘要:Given a non-empty binary search tree and a target value, find k values in the BST that are closest to the target. Note: Given target value is a floati 阅读全文
posted @ 2017-03-24 02:57 CodesKiller 阅读(204) 评论(0) 推荐(0)
摘要:Given a binary search tree, write a function kthSmallest to find the kth smallest element in it. Note: You may assume k is always valid, 1 ≤ k ≤ BST's 阅读全文
posted @ 2017-03-24 01:44 CodesKiller 阅读(134) 评论(0) 推荐(0)
摘要:Implement an iterator over a binary search tree (BST). Your iterator will be initialized with the root node of a BST. Calling next() will return the n 阅读全文
posted @ 2017-03-24 01:10 CodesKiller 阅读(196) 评论(0) 推荐(0)
摘要:Given a binary tree, return the postorder traversal of its nodes' values. For example:Given binary tree {1,#,2,3}, return [3,2,1]. Note: Recursive sol 阅读全文
posted @ 2017-03-23 11:32 CodesKiller 阅读(162) 评论(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 @ 2017-03-23 10:28 CodesKiller 阅读(158) 评论(0) 推荐(0)
摘要:Given an array of numbers, verify whether it is the correct preorder traversal sequence of a binary search tree. You may assume each number in the seq 阅读全文
posted @ 2017-03-23 08:42 CodesKiller 阅读(169) 评论(0) 推荐(0)
摘要:Given a binary tree, return the preorder traversal of its nodes' values. For example:Given binary tree {1,#,2,3}, return [1,2,3]. Note: Recursive solu 阅读全文
posted @ 2017-03-23 06:40 CodesKiller 阅读(169) 评论(0) 推荐(0)

1 2 3 4 5 ··· 11 下一页