• 博客园logo
  • 会员
  • 周边
  • 新闻
  • 博问
  • 闪存
  • 众包
  • 赞助商
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
UsSam
博客园 | 首页 | 新随笔 | 新文章 | 联系 | 订阅 订阅 | 管理

2014年3月7日

【Leetcode】Search in Rotated Sorted Array II
摘要: 题目:Follow up for "Search in Rotated Sorted Array":What ifduplicatesare allowed?Would this affect the run-time complexity? How and why?Write a function to determine if a given target is in the array.解题思路:该题与Search in Rotated Sorted Array的主要区别在于需要考虑A[low]与A[mid]相等、A[mid]与A[high]相等以及A[low]A[m 阅读全文
posted @ 2014-03-07 22:07 UsSam 阅读(113) 评论(0) 推荐(0)
 
【Leetcode】Search in Rotated Sorted Array
摘要: 题目:Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e.,0 1 2 4 5 6 7might become4 5 6 7 0 1 2).You are given a target value to search. If found in the array return its index, otherwise return -1.You may assume no duplicate exists in the array.解题思路:数组的查找一般可以使用二分查找法,但是这道题里的 阅读全文
posted @ 2014-03-07 12:39 UsSam 阅读(135) 评论(0) 推荐(0)
 
 

公告


博客园  ©  2004-2026
浙公网安备 33010602011771号 浙ICP备2021040463号-3