摘要: Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the arr... 阅读全文
posted @ 2015-09-20 17:55 vincently 阅读(188) 评论(0) 推荐(0) 编辑
摘要: Given an integer array of sizen, find all elements that appear more than⌊ n/3 ⌋times. The algorithm should run in linear time and in O(1) space.分析:和Ma... 阅读全文
posted @ 2015-09-20 16:20 vincently 阅读(188) 评论(0) 推荐(0) 编辑
摘要: Given an arraynums, write a function to move all0's to the end of it while maintaining the relative order of the non-zero elements.For example, givenn... 阅读全文
posted @ 2015-09-20 14:32 vincently 阅读(195) 评论(0) 推荐(0) 编辑
摘要: 题目来源:《剑指offer》面试题36 题目:在数组中的两个数字如果前面一个数字大于后面的数字,则这两个数字组成一个逆序对。输入一个数组,求出这两个数组中的逆序对的总数。例如数组{7,5,6,4}中,一共存在5个逆序对,分别是(7,6),(7,5),(7,4),(6,4)和(5,4)。 下面... 阅读全文
posted @ 2015-09-20 11:58 vincently 阅读(326) 评论(0) 推荐(0) 编辑
摘要: Write a program to find then-th ugly number.Ugly numbers are positive numbers whose prime factors only include2, 3, 5. For example,1, 2, 3, 4, 5, 6, 8... 阅读全文
posted @ 2015-09-20 08:55 vincently 阅读(184) 评论(0) 推荐(0) 编辑