- 博客(9)
- 收藏
- 关注
原创 Arranging Coins
You have a total of n coins that you want to form in a staircase shape, where every k-th row must have exactly k coins.Given n, find the total number of full staircase rows that can be formed.n is...
2018-08-23 11:35:19 134
原创 Classical Binary Search
Find any position of a target number in a sorted array. Return-1if target does not exist.ExampleExample 1:Input: nums = [1,2,2,4,5,5], target = 2Output: 1 or 2Example 2:Input: nums = [...
2018-08-21 13:42:07 435
原创 Peak Index in a Mountain Array
Let's call an array A a mountain if the following properties hold:A.length >= 3 There exists some 0 < i < A.length - 1 such that A[0] < A[1] < ... A[i-1] < A[i] > A[i+1] > ....
2018-08-21 11:58:57 197
原创 Sum of Square Numbers
Given a non-negative integer c, your task is to decide whether there're two integers a and b such that a2 + b2 = c.Example 1:Input: 5Output: TrueExplanation: 1 * 1 + 2 * 2 = 5Example 2:In...
2018-08-20 08:53:37 97
原创 Maximum Product of Three Numbers
Given an integer array, find three numbers whose product is maximum and output the maximum product.Example 1:Input: [1,2,3]Output: 6Example 2:Input: [1,2,3,4]Output: 24Note:The lengt...
2018-08-12 12:43:49 246
原创 Array Partition I
Given an array of 2n integers, your task is to group these integers into n pairs of integer, say (a1, b1), (a2, b2), ..., (an, bn) which makes sum of min(ai, bi) for all i from 1 to n as large as poss...
2018-08-10 13:20:05 387
原创 Find All Duplicates in an Array
Given an array of integers, 1 ≤ a[i] ≤n(n= size of array), some elements appeartwiceand others appearonce.Find all the elements that appeartwicein this array.Could you do it without extra ...
2018-08-08 13:04:56 161
原创 Find All Numbers Disappeared in an Array
Given an array of integers where 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once.Find all the elements of [1, n] inclusive that do not appear in this array.Coul...
2018-08-08 11:34:28 163
原创 Contains Duplicate
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 array, and it should return false if every element i...
2018-08-06 13:20:38 216
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人