问题: Rotate an array of n elements to the right by k steps. For example, with n = 7 and k = 3, the array [1,2,3,4,5,6,7] is rotated to [5,6,7,1,2,3,4]. ...
分类:
其他好文 时间:
2016-09-26 00:38:55
阅读次数:
145
Rotate an array of n elements to the right by k steps. For example, with n = 7 and k = 3, the array [1,2,3,4,5,6,7] is rotated to [5,6,7,1,2,3,4]. Not ...
分类:
其他好文 时间:
2016-09-22 12:49:09
阅读次数:
116
Suppose a sorted array is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2). You are given a target va ...
分类:
其他好文 时间:
2016-09-16 22:35:16
阅读次数:
162
1 Search in Rotated Sorted Array 二分搜索,注意分清各种情况 1 public class Solution { 2 public int search(int[] nums, int target) { 3 int i = 0, j = nums.length - ...
分类:
其他好文 时间:
2016-09-16 07:53:35
阅读次数:
191
1. 问题描述 189. Rotate ArrayRotate an array of n elements to the right by k steps.For example, with n = 7 and k = 3, the array [1,2,3,4,5,6,7] is rotated ...
分类:
其他好文 时间:
2016-09-11 01:24:10
阅读次数:
142
和上题一样,本题的序列中可能有重复的元素,不过用上题的代码能过 ...
分类:
其他好文 时间:
2016-08-31 20:27:07
阅读次数:
136
一个递增数组,没有重复的元素,可能被右移过,找出最小的元素 这和这题差不多http://www.cnblogs.com/0summer/p/5825282.html 依旧是改进过的二分: 1.如果nums[l]<nums[mid],说明[l,mid]是递增的,但是[mid,r]不确定 1)如果num ...
分类:
其他好文 时间:
2016-08-31 20:15:29
阅读次数:
108