摘要: Given a non-empty array of integers, return the k most frequent elements. For example,Given [1,1,1,2,2,3] and k = 2, return [1,2]. Note: You may assum 阅读全文
posted @ 2016-07-04 17:22 Miller1991 阅读(179) 评论(0) 推荐(0) 编辑
摘要: Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element. For exam 阅读全文
posted @ 2016-07-04 16:44 Miller1991 阅读(129) 评论(0) 推荐(0) 编辑
摘要: Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red, 阅读全文
posted @ 2016-07-04 16:23 Miller1991 阅读(127) 评论(0) 推荐(0) 编辑
摘要: The count-and-say sequence is the sequence of integers beginning as follows:1, 11, 21, 1211, 111221, ... 1 is read off as "one 1" or 11.11 is read off 阅读全文
posted @ 2016-07-04 16:00 Miller1991 阅读(153) 评论(0) 推荐(0) 编辑
摘要: Calculate the sum of two integers a and b, but you are not allowed to use the operator + and -. Example:Given a = 1 and b = 2, return 3. Credits:Speci 阅读全文
posted @ 2016-07-04 15:43 Miller1991 阅读(144) 评论(0) 推荐(0) 编辑
摘要: Write a program to find the nth super ugly number. Super ugly numbers are positive numbers whose all prime factors are in the given prime list primes  阅读全文
posted @ 2016-07-04 15:18 Miller1991 阅读(124) 评论(0) 推荐(0) 编辑
摘要: Given a 2d grid map of '1's (land) and '0's (water), count the number of islands. An island is surrounded by water and is formed by connecting adjacen 阅读全文
posted @ 2016-07-04 10:32 Miller1991 阅读(123) 评论(0) 推荐(0) 编辑