• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
neverlandly
博客园    首页    新随笔    联系   管理    订阅  订阅
2016年11月28日
Leetcode: Kth Smallest Element in a Sorted Matrix
摘要: Heap: you need to know the row number and column number of that element(so we can create a tuple class here) Binary Search方法:(12/28仔细看了之后觉得没必要深究,有时间再去 阅读全文
posted @ 2016-11-28 13:02 neverlandly 阅读(426) 评论(0) 推荐(0)
Leetcode: Combination Sum IV && Summary: The Key to Solve DP
摘要: DP 解法: the key to solve DP problem is to think about how to create overlap, how to re-solve subproblems(怎么制造复用) Bottom up dp: Better Solution(Bottom-u 阅读全文
posted @ 2016-11-28 11:40 neverlandly 阅读(329) 评论(0) 推荐(0)
Leetcode: Wiggle Subsequence
摘要: DP solution is O(N^2), better way is greedy Now for explanation, we take example series:2,1,4,5,6,3,3,4,8,4 First we check if the series is starting a 阅读全文
posted @ 2016-11-28 10:26 neverlandly 阅读(533) 评论(0) 推荐(0)
Leetcode: Guess Number Higher or Lower II
摘要: Clarification of the problem: https://discuss.leetcode.com/topic/68252/clarification-on-the-problem-description-problem-description-need-to-be-updated 阅读全文
posted @ 2016-11-28 06:43 neverlandly 阅读(838) 评论(0) 推荐(0)
Leetcode: Guess Number Higher or Lower
摘要: Binary Search Here "My" means the number which is given for you to guess not the number you put into guess(int num). 阅读全文
posted @ 2016-11-28 05:33 neverlandly 阅读(401) 评论(0) 推荐(0)
Leetcode: Find K Pairs with Smallest Sums
摘要: Better Solution: O(KlogK), 转自https://discuss.leetcode.com/topic/50885/simple-java-o-klogk-solution-with-explanation Some observations: For every numbe 阅读全文
posted @ 2016-11-28 04:55 neverlandly 阅读(586) 评论(0) 推荐(0)
Leetcode: Super Pow
摘要: ab % k = (a%k)(b%k)%kSince the power here is an array, we'd better handle it digit by digit.One observation:a^1234567 % k = (a^1234560 % k) * (a^7 % k 阅读全文
posted @ 2016-11-28 01:48 neverlandly 阅读(398) 评论(0) 推荐(0)
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3