Power of Four

Given an integer (signed 32 bits), write a function to check whether it is a power of 4. Example: Given num = 16, return true.Given num = 5, return...

2016-09-19 22:01:12

阅读数:133

评论数:0

Flatten Nested List Iterator

Given a nested list of integers, implement an iterator to flatten it. Each element is either an integer, or a list -- whose elements may also be int...

2016-09-19 21:29:43

阅读数:261

评论数:0

Self Crossing

You are given an array x of n positive numbers. You start at point (0,0) and moves x[0] metres to the north, then x[1] metres to the west, x[2] met...

2016-09-18 17:03:37

阅读数:118

评论数:0

Increasing Triplet Subsequence

Given an unsorted array return whether an increasing subsequence of length 3 exists or not in the array. Formally the function should: Return tru...

2016-09-18 11:38:43

阅读数:101

评论数:0

Design Twitter

Design a simplified version of Twitter where users can post tweets, follow/unfollow another user and is able to see the 10 most recent tweets in the ...

2016-09-17 21:59:38

阅读数:113

评论数:0

Reconstruct Itinerary

Given a list of airline tickets represented by pairs of departure and arrival airports [from, to], reconstruct the itinerary in order. All of the tic...

2016-09-13 18:45:21

阅读数:113

评论数:0

Verify Preorder Serialization of a Binary Tree

One way to serialize a binary tree is to use pre-order traversal. When we encounter a non-null node, we record the node's value. If it is a null node...

2016-09-13 16:03:34

阅读数:113

评论数:0

Patching Array

Given a sorted positive integer array nums and an integer n, add/patch elements to the array such that any number in range [1, n] inclusive can be f...

2016-09-12 20:17:49

阅读数:180

评论数:0

Longest Increasing Path in a Matrix

Given an integer matrix, find the length of the longest increasing path. From each cell, you can either move to four directions: left, right, up or ...

2016-09-11 16:02:28

阅读数:153

评论数:0

Wiggle Sort II

Given an unsorted array nums, reorder it such that nums[0] nums[2] . Example: (1) Given nums = [1, 5, 1, 1, 6, 4], one possible answer is [1, 4, 1...

2016-09-09 18:48:26

阅读数:156

评论数:0

Maximum Product of Word Lengths

Given a string array words, find the maximum value of length(word[i]) * length(word[j]) where the two words do not share common letters. You may assu...

2016-09-08 19:41:04

阅读数:136

评论数:0

Valid Perfect Square

Given a positive integer num, write a function which returns True if num is a perfect square else False. Note: Do not use any built-in library fun...

2016-09-07 18:36:28

阅读数:108

评论数:0

Insert Delete GetRandom O(1) - Duplicates allowed

Design a data structure that supports all following operations in average O(1) time. Note: Duplicate elements are allowed. insert(val): Inserts ...

2016-09-07 17:10:19

阅读数:107

评论数:0

Insert Delete GetRandom O(1)

Design a data structure that supports all following operations in average O(1) time. insert(val): Inserts an item val to the set if not already p...

2016-09-07 15:37:50

阅读数:158

评论数:0

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...

2016-09-06 15:05:31

阅读数:422

评论数:0

Longest Substring with At Least K Repeating Characters

Find the length of the longest substring T of a given string (consists of lowercase letters only) such that every character in T appears no less tha...

2016-09-06 13:20:37

阅读数:1113

评论数:0

Find K Pairs with Smallest Sums

You are given two integer arrays nums1 and nums2 sorted in ascending order and an integer k. Define a pair (u,v) which consists of one element fro...

2016-09-05 17:34:59

阅读数:160

评论数:0

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 ...

2016-09-02 17:28:19

阅读数:145

评论数:0

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...

2016-09-02 15:33:59

阅读数:124

评论数:0

提示
确定要删除当前文章?
取消 删除
关闭
关闭