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

2016年5月9日

摘要: Sort a linked list in O(n log n) time using constant space complexity. 代码如下: 阅读全文
posted @ 2016-05-09 15:16 烁宝宝 阅读(171) 评论(0) 推荐(0)

2016年5月5日

摘要: Suppose a sorted array is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2). Find the minimum element. 阅读全文
posted @ 2016-05-05 15:09 烁宝宝 阅读(108) 评论(0) 推荐(0)
 
摘要: A peak element is an element that is greater than its neighbors. Given an input array where num[i] ≠ num[i+1], find a peak element and return its inde 阅读全文
posted @ 2016-05-05 15:04 烁宝宝 阅读(182) 评论(0) 推荐(0)

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)
上一页 1 ··· 4 5 6 7 8 9 10 11 下一页