• 博客园logo
  • 会员
  • 周边
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
neverlandly
博客园    首页    新随笔    联系   管理    订阅  订阅
2016年12月8日
Leetcode: K-th Smallest in Lexicographical Order
摘要: 第二遍做法:参考https://discuss.leetcode.com/topic/64624/concise-easy-to-understand-java-5ms-solution-with-explaination Actually this is a denary tree (each n 阅读全文
posted @ 2016-12-08 07:37 neverlandly 阅读(648) 评论(0) 推荐(0)
Leetcode: Minimum Number of Arrows to Burst Balloons
摘要: 我的Greedy+Heap做法: Array按start moment升序sort,Heap里按end moment升序sort,一旦到Heap里结束时间最早的气球的end,就要扔arrow,这时在heap里的气球都会被引爆 改进:因为一旦气球爆了的话,Heap里面的元素要全部清空,不需要知道Hea 阅读全文
posted @ 2016-12-08 04:33 neverlandly 阅读(527) 评论(0) 推荐(0)
Leetcode: Minimum Moves to Equal Array Elements
摘要: idea 1: suppose it takes y steps to equal each elements, then this equation stands: (min + y) * num.length == sum + (num.length-1)*y, where min + y is 阅读全文
posted @ 2016-12-08 00:48 neverlandly 阅读(409) 评论(0) 推荐(0)
博客园  ©  2004-2026
浙公网安备 33010602011771号 浙ICP备2021040463号-3