- 博客(14)
- 收藏
- 关注
原创 [394]Decode String
【题目描述】 Given an encoded string, return it's decoded string. The encoding rule is: k[encoded_string], where the encoded_string inside the square brackets is being repeated exactly k times. No
2016-09-16 17:46:54 847
原创 [396]Rotate Function
【题目描述】 Given an array of integers A and let n to be its length. Assume Bk to be an array obtained by rotating the array A k positions clock-wise, we define a "rotation function" F on A as
2016-09-14 11:09:58 296
原创 [309] Best Time to Buy and Sell Stock with Cooldown
【题目描述】 Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may complete as many transactions as you like
2016-09-08 21:27:15 293
原创 [337]House Robber III
【题目描述】 The thief has found himself a new place for his thievery again. There is only one entrance to this area, called the "root." Besides the root, each house has one and only one parent house.
2016-09-07 21:53:38 222
原创 [377] Combination Sum IV
【题目描述】 Given an integer array with all positive numbers and no duplicates, find the number of possible combinations that add up to a positive integer target. Example: nums = [1, 2, 3] target
2016-09-06 17:21:33 214
原创 [392]Is Subsequence
【题目描述】 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 potentially a very long (length ~= 50
2016-09-06 15:10:03 371
原创 [319]Bulb Switcher
【题目描述】 There are n bulbs that are initially off. You first turn on all the bulbs. Then, you turn off every second bulb. On the third round, you toggle every third bulb (turning on if it's off or
2016-09-05 20:33:39 176
原创 [343]Integer Break
【题目描述】 Given a positive integer n, break it into the sum of at least two positive integers and maximize the product of those integers. Return the maximum product you can get. For example, give
2016-09-05 15:49:45 242
原创 [357]Count Numbers with Unique Digits
【题目描述】 Given a non-negative integer n, count all numbers with unique digits, x, where 0 ≤ x n. Example: Given n = 2, return 91. (The answer should be the total numbers in the range of 0 ≤ x [
2016-09-05 11:33:52 207
原创 [347] Top K Frequent Elements
【题目描述】 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 assume k is always valid, 1 ≤
2016-09-04 14:30:30 196
原创 [382]Linked List Random Node
【题目描述】 Given a singly linked list, return a random node's value from the linked list. Each node must have the same probability of being chosen. Follow up: What if the linked list is extremely
2016-09-03 13:44:48 235
原创 [167]Two Sum II - Input array is sorted
【题目描述】 Given an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target number. The function twoSum should return indices of th
2016-09-03 10:25:36 197
原创 [15]3Sum
【题目描述】 Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero. Note: The solution set must
2016-09-02 11:27:37 184
原创 [374]Guess Number Higher or Lower
【题目描述】 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 wrong, I'll tell you whether the
2016-09-01 11:44:33 183
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人