• 博客园logo
  • 会员
  • 周边
  • 新闻
  • 博问
  • 闪存
  • 众包
  • 赞助商
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
neverlandly
博客园    首页    新随笔    联系   管理    订阅  订阅
2016年12月15日
Leetcode: Longest Substring with At Most K Distinct Characters && Summary: Window做法两种思路总结
摘要: 我的做法:维护一个window,r移动到超出k distinct character限制是更新max,然后移动l使distinct character <=k; 这种做法更新max只发生在超出限制的时候,有可能永远都没有超出限制,所以while loop完了之后要补上一个max的更新 别人非常棒的做 阅读全文
posted @ 2016-12-15 11:41 neverlandly 阅读(210) 评论(0) 推荐(0)
Design Tic-Tac Toe
摘要: Hint: 看了hint之后想到:既然用数组的话,一行一列都是一个element来代表,估计这个element是要用sum了,那么,能不能用sum来代表一行,使它有且只有一种可能,全部是player1完成的/全部是Player2;所以想到了是Player1就+1,是player2就-1,看最后sum 阅读全文
posted @ 2016-12-15 10:59 neverlandly 阅读(389) 评论(0) 推荐(0)
Leetcode: Moving Average from Data Stream
摘要: Queue method: Array method: 非常聪明 阅读全文
posted @ 2016-12-15 09:54 neverlandly 阅读(397) 评论(0) 推荐(0)
Leetcode: Nested List Weight Sum II
摘要: Inspired by: https://discuss.leetcode.com/topic/49041/no-depth-variable-no-multiplication Instead of multiplying by depth, add integers multiple times 阅读全文
posted @ 2016-12-15 07:35 neverlandly 阅读(657) 评论(0) 推荐(0)
Leetcode: Nested List Weight Sum
摘要: DFS: 阅读全文
posted @ 2016-12-15 06:31 neverlandly 阅读(267) 评论(0) 推荐(0)
Leetcode: Largest BST Subtree
摘要: refer to https://discuss.leetcode.com/topic/36995/share-my-o-n-java-code-with-brief-explanation-and-comments/2 这道题不好从root到leaf一层一层限制subtree取值范围,因为有可能p 阅读全文
posted @ 2016-12-15 05:59 neverlandly 阅读(332) 评论(0) 推荐(0)
Leetcode: Wiggle Sort II
摘要: 这道题应该是hard,首先思想上面参考了https://discuss.leetcode.com/topic/32861/3-lines-python-with-explanation-proof I put the smaller half of the numbers on the even i 阅读全文
posted @ 2016-12-15 03:36 neverlandly 阅读(478) 评论(0) 推荐(0)
博客园  ©  2004-2026
浙公网安备 33010602011771号 浙ICP备2021040463号-3