A strobogrammatic number is a number that looks the same when rotated 180 degrees (looked at upside down). Write a function to count the total strobog
分类:
其他好文 时间:
2016-02-20 15:55:09
阅读次数:
132
题意:给一个旋转过的升序序列,比如[0, 1, 2, 3, 4]可以旋转为[2, 3, 4, 0, 1],然后给一个目标数,求他在不在这个序列中。 解法:如果不旋转的话就是个普通的二分查找,但是旋转之后需要算index什么的好麻烦……旋转的偏移量也可用二分求,所以就是两次二分……对于我这个二分苦手来
分类:
其他好文 时间:
2016-02-18 13:32:30
阅读次数:
136
A strobogrammatic number is a number that looks the same when rotated 180 degrees (looked at upside down). Write a function to determine if a number i
分类:
其他好文 时间:
2016-02-18 01:16:31
阅读次数:
258
原题链接 直接贴代码,这道题是 search in rotated sorted array leetcode 的前面部分! 1 class Solution { 2 public: 3 int findMin(vector<int>& nums) { 4 if (nums.empty()) 5 r
分类:
其他好文 时间:
2016-02-10 10:55:01
阅读次数:
180
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-02-06 22:17:03
阅读次数:
149
Link: https://leetcode.com/problems/find-minimum-in-rotated-sorted-array-ii/ Follow up for "Find Minimum in Rotated Sorted Array": What if duplicates
分类:
其他好文 时间:
2016-02-01 22:22:38
阅读次数:
206
public class Solution { public boolean search(int[] nums, int target) { int len = nums.length; if(len == 0) return false; int ...
分类:
其他好文 时间:
2016-01-24 07:02:47
阅读次数:
169
Problem: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).Find the minimum el...
分类:
其他好文 时间:
2016-01-20 22:31:27
阅读次数:
221
Problem: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 tar...
分类:
其他好文 时间:
2016-01-20 22:15:25
阅读次数:
132
Given arotatedsorted array, recover it to sorted array in-place.Example[4, 5, 1, 2, 3]->[1, 2, 3, 4, 5]ChallengeIn-place, O(1) extra space and O(n) ti...
分类:
其他好文 时间:
2016-01-19 10:37:48
阅读次数:
129