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

2015年11月15日

LeetCode() Find Minimum in Rotated Sorted Array
摘要: 不明白这个思路class Solution {public: int findMin(vector& num) { int size = num.size() - 1; int l = 0; int r = size; while(l n... 阅读全文
posted @ 2015-11-15 21:09 yanqi 阅读(108) 评论(0) 推荐(0)
 
LeetCode(169)Majority Element and Majority Element II
摘要: 一个数组里有一个数重复了n/2多次,找到思路:既然这个数重复了一半以上的长度,那么排序后,必然占据了 a[n/2]这个位置。class Solution {public: int majorityElement(vector& nums) { sort(nums.begin(),... 阅读全文
posted @ 2015-11-15 14:31 yanqi 阅读(122) 评论(0) 推荐(0)
 
 

公告


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