2016年4月28日

摘要: Given an integer array of size n, find all elements that appear more than ⌊ n/3 ⌋ times. The algorithm should run in linear time and in O(1) space. 代码 阅读全文
posted @ 2016-04-28 20:14 烁宝宝 阅读(145) 评论(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 @ 2016-04-28 16:59 烁宝宝 阅读(123) 评论(0) 推荐(0)
 
摘要: Given an array of n integers where n > 1, nums, return an array output such that output[i] is equal to the product of all the elements of nums except  阅读全文
posted @ 2016-04-28 15:58 烁宝宝 阅读(154) 评论(0) 推荐(0)
 
摘要: Given an array of numbers nums, in which exactly two elements appear only once and all the other elements appear exactly twice. Find the two elements 阅读全文
posted @ 2016-04-28 14:47 烁宝宝 阅读(124) 评论(0) 推荐(0)
 
摘要: Write a program to find the n-th ugly number. Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For example, 1, 2, 3, 4, 5, 阅读全文
posted @ 2016-04-28 13:51 烁宝宝 阅读(118) 评论(0) 推荐(0)
 
摘要: Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array. For example,Given nums = [0, 1, 阅读全文
posted @ 2016-04-28 13:01 烁宝宝 阅读(158) 评论(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 @ 2016-04-28 11:42 烁宝宝 阅读(155) 评论(0) 推荐(0)