加载中
找到数组中至少是数组中其他值的两倍的最大值

Largest Number At Least Twice of Others 问题: In a given integer array nums, there is always exactly one largest element....

2018/02/01 11:15
41
找到数组中左右两边的和相等的pivot的下标 Find Pivot Index

问题: Given an array of integers nums, write a method that returns the "pivot" index of this array. We define the pivot index as the index where the sum of the numbers to the l...

2018/01/17 10:06
35
判断给定的数组最后一个元素是否属于0编码,而不是10编码

1-bit and 2-bit Characters 问题: We have two special characters. The first character can be represented by one bit 0. The second character can be represented by two bits (10 o...

2018/01/17 10:05
4
数组的子数组中度与原数组相同的个数 Degree of an Array

问题: Given a non-empty array of non-negative integers nums, the degree of this array is defined as the maximum frequency of any one of its elements. Your task is to find the s...

2018/01/16 09:18
8
判断数组是否为非递减的(最多交换一次)Non-decreasing Array

问题: Given an array with n integers, your task is to check if it could become non-decreasing by modifying at most 1 element. We define an array is non-decreasing if array[i] <...

2018/01/15 09:41
120
逆波兰表达式求和 Baseball Game

问题: You're now a baseball game point recorder. Given a list of strings, each string can be one of the 4 following types: Integer (one round's score): Directly represents the ...

2018/01/15 09:40
5
最长连续递增子序列的长度

Longest Continuous Increasing Subsequence 问题: Given an unsorted array of integers, find the length of longest continuous increasing subsequence (subarray). Example 1: Input: ...

2018/01/14 12:29
13
判断数组是否为非递减数组 Non-decreasing Array

问题: Given an array with n integers, your task is to check if it could become non-decreasing by modifying at most 1 element. We define an array is non-decreasing if array[i] <...

2018/01/14 12:28
25
包含k个数的最大子数组的平均值 Maximum Average Subarray I

问题: Given an array consisting of n integers, find the contiguous subarray of given length k that has the maximum average value. And you need to output the maximum average val...

2017/08/15 21:05
9
只出现一次的数 Single Number

问题: Given an array of integers, every element appears twice except for one. Find that single one. Note: Your algorithm should have a linear runtime complexity. Could you impl...

2017/06/20 17:35
5
两数之和 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 retur...

2017/06/06 19:25
9
主元素 Majority Element

问题: Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times. You may assume that the array is non-empt...

2017/06/06 17:09
15
合并两有序数组 Merge Sorted Array

问题: Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array. Note: You may assume that nums1 has enough space (size that is greater or equ...

2017/06/06 15:14
6
数组划分获取较小值的和 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 ...

2017/06/05 20:10
10
和最大的连续子数组 Maximum Subarray

问题: Find the contiguous subarray within an array (containing at least one number) which has the largest sum. For example, given the array [-2,1,-3,4,-1,2,1,-5,4], the contigu...

2017/06/05 17:09
6
杨辉三角 Pascal's Triangle II

问题: Given an index k, return the kth row of the Pascal's triangle. For example, given k = 3, Return [1,3,3,1]. Note: Could you optimize your algorithm to use only O(k) extra ...

2017/06/04 21:39
12
第3大的数 Third Maximum Number

问题: Given a non-empty array of integers, return the third maximum number in this array. If it does not exist, return the maximum number. The time complexity must be in O(n). ...

2017/06/04 17:35
10
查找丢失的数 Missing Number

问题: Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array. Example 1 Input: [3,0,1] Output: 2 Example 2 Input: ...

2017/06/04 16:57
4
判断能否种花 Can Place Flowers

问题: Suppose you have a long flowerbed in which some of the plots are planted and some are not. However, flowers cannot be planted in adjacent plots - they would compete for w...

2017/06/04 15:18
4
杨辉三角 Pascal's Triangle

问题: Given numRows, generate the first numRows of Pascal's triangle. For example, given numRows = 5, Return [ [1], [1,1], [1,2,1], [1,3,3,1], [1,4,6,4,1] ] 解决: ①直接计算,...

2017/06/02 21:56
5

没有更多内容

加载失败,请刷新页面

返回顶部
顶部