随笔分类 -  leetcode_binarySearch

摘要:Given a complete binary tree, count the number of nodes. 题目含义:给定一个完整二叉树,求所有节点数 百度百科中完全二叉树的定义如下:若设二叉树的深度为h,除第 h 层外,其它各层 (1~h-1) 的结点数都达到最大个数,第 h 层所有的结点都 阅读全文
posted @ 2017-10-25 20:20 daniel456 阅读(140) 评论(0) 推荐(0) 编辑
摘要:Divide two integers without using multiplication, division and mod operator. If it is overflow, return MAX_INT. 题目含义:不要使用乘 除 取模,计算除法 方法一: 阅读全文
posted @ 2017-10-24 16:05 daniel456 阅读(135) 评论(0) 推荐(0) 编辑
摘要:Implement pow(x, n). 题目含义:实现x的n次方 阅读全文
posted @ 2017-10-24 15:46 daniel456 阅读(114) 评论(0) 推荐(0) 编辑
摘要:Follow up for H-Index: What if the citations array is sorted in ascending order? Could you optimize your algorithm? 题目含义:给定的数组是有序的,再次找h值 相关题目: 274. H- 阅读全文
posted @ 2017-10-24 15:43 daniel456 阅读(197) 评论(0) 推荐(0) 编辑
摘要:Given a sorted array, two integers k and x, find the k closest elements to x in the array. The result should also be sorted in ascending order. If the 阅读全文
posted @ 2017-10-24 15:40 daniel456 阅读(369) 评论(0) 推荐(0) 编辑
摘要:Given a set of intervals, for each of the interval i, check if there exists an interval j whose start point is bigger than or equal to the end point o 阅读全文
posted @ 2017-10-24 15:25 daniel456 阅读(142) 评论(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-10-24 15:16 daniel456 阅读(207) 评论(0) 推荐(0) 编辑
摘要:You are a product manager and currently leading a team to develop a new product. Unfortunately, the latest version of your product fails the quality c 阅读全文
posted @ 2017-10-24 15:12 daniel456 阅读(127) 评论(0) 推荐(0) 编辑
摘要:We are playing the Guess Game. The game is as follows: I pick a number from 1 to n. You have to guess which number I picked. Every time you guess wron 阅读全文
posted @ 2017-10-24 15:10 daniel456 阅读(120) 评论(0) 推荐(0) 编辑
摘要:Given four lists A, B, C, D of integer values, compute how many tuples (i, j, k, l) there are such that A[i] + B[j] + C[k] + D[l]is zero. To make prob 阅读全文
posted @ 2017-10-24 10:45 daniel456 阅读(88) 评论(0) 推荐(0) 编辑
摘要:Given two arrays, write a function to compute their intersection. Example:Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2]. Note: Each element i 阅读全文
posted @ 2017-10-23 21:00 daniel456 阅读(101) 评论(0) 推荐(0) 编辑
摘要:Given two arrays, write a function to compute their intersection. 题目含义z:计算两个数组的交集,重复的数字要保留 阅读全文
posted @ 2017-10-23 13:55 daniel456 阅读(117) 评论(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-10-22 21:58 daniel456 阅读(105) 评论(0) 推荐(0) 编辑
摘要:You have a total of n coins that you want to form in a staircase shape, where every k-th row must have exactly k coins. Given n, find the total number 阅读全文
posted @ 2017-10-20 20:53 daniel456 阅读(198) 评论(0) 推荐(0) 编辑
摘要:Given a positive integer num, write a function which returns True if num is a perfect square else False. 题目含义:判断一个数能否被开方 阅读全文
posted @ 2017-10-20 20:39 daniel456 阅读(83) 评论(0) 推荐(0) 编辑
摘要:Implement int sqrt(int x). Compute and return the square root of x. 题目题目:返回一个int数开方后的结果 阅读全文
posted @ 2017-10-20 19:40 daniel456 阅读(110) 评论(0) 推荐(0) 编辑
摘要:Given a string s and a string t, check if s is subsequence of t. You may assume that there is only lower case English letters in both s and t. t is po 阅读全文
posted @ 2017-10-19 20:08 daniel456 阅读(165) 评论(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-10-19 17:34 daniel456 阅读(121) 评论(0) 推荐(0) 编辑
摘要:Given an array nums containing n + 1 integers where each integer is between 1 and n (inclusive), prove that at least one duplicate number must exist. 阅读全文
posted @ 2017-10-16 16:55 daniel456 阅读(152) 评论(0) 推荐(0) 编辑
摘要:Given an array of n positive integers and a positive integer s, find the minimal length of a contiguous subarray of which the sum ≥ s. If there isn't 阅读全文
posted @ 2017-10-16 16:26 daniel456 阅读(99) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示