• 博客园logo
  • 会员
  • 周边
  • 新闻
  • 博问
  • 闪存
  • 众包
  • 赞助商
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
neverlandly
博客园    首页    新随笔    联系   管理    订阅  订阅
2016年12月19日
Leetcode: Ones and Zeroes
摘要: This is a 0/1 backpacking problem The problem can be interpreted as: What's the max number of str can we pick from strs with limitation of m "0"s and  阅读全文
posted @ 2016-12-19 13:32 neverlandly 阅读(488) 评论(0) 推荐(0)
Leetcode: Heaters
摘要: Binary Search My solution: Be careful in my binary search function, l, r may go out of the range of the array Solution with the highest vote: 阅读全文
posted @ 2016-12-19 13:09 neverlandly 阅读(467) 评论(0) 推荐(0)
Leetcode: Total Hamming Distance
摘要: Example: 0 0 0 0 0 1 0 0 1 1 1 0 0 0 1 0 Total Hamming Distance = (3*1) + (2*2) + (2*2) + (4*0) = 11 so the idea is count the number of 1 and 0 on eac 阅读全文
posted @ 2016-12-19 11:03 neverlandly 阅读(954) 评论(0) 推荐(0)
Leetcode: Hamming Distance
摘要: Solution 1: Solution 2: 阅读全文
posted @ 2016-12-19 09:17 neverlandly 阅读(239) 评论(0) 推荐(0)
Leetcode: Valid Word Square
摘要: 这题看起来简单但是其实很容易写错 本来想j 不从0开始,而是从 i+1开始检查,可以节省时间,但是一些为Null的情况会使讨论很复杂 比如 阅读全文
posted @ 2016-12-19 08:37 neverlandly 阅读(295) 评论(0) 推荐(0)
Leetcode: Sentence Screen Fitting
摘要: 先来一个brute force, 类似Text Adjustment 但是在稍微大一点的case就TLE了,比如: ["a","b","e"] 20000 20000, 花了465ms 所以想想怎么节约时间, 提示是可以DP的,想想怎么复用,refer to: https://discuss.lee 阅读全文
posted @ 2016-12-19 07:16 neverlandly 阅读(1142) 评论(0) 推荐(0)
Leetcode: Minimum Unique Word Abbreviation
摘要: Refer to https://discuss.leetcode.com/topic/61799/java-bit-mask-dfs-with-pruning bit mask refer to http://bookshadow.com/weblog/2016/10/02/leetcode-mi 阅读全文
posted @ 2016-12-19 04:47 neverlandly 阅读(888) 评论(0) 推荐(0)
博客园  ©  2004-2026
浙公网安备 33010602011771号 浙ICP备2021040463号-3