• 博客园logo
  • 会员
  • 周边
  • 新闻
  • 博问
  • 闪存
  • 众包
  • 赞助商
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
neverlandly
博客园    首页    新随笔    联系   管理    订阅  订阅
2016年12月23日
Leetcode: Poor Pigs
摘要: My binary encoding method gives a 8 for the first problem, however, there is a smarter method that generates a answer of 5, which can be found here: h 阅读全文
posted @ 2016-12-23 11:37 neverlandly 阅读(1112) 评论(0) 推荐(0)
Leetcode: Validate IP Address
摘要: Be careful, split() will not include trailing empty strings in the result array The string "boo:and:foo", for example, split(":")的结果是 {“boo”, "and", " 阅读全文
posted @ 2016-12-23 08:44 neverlandly 阅读(1092) 评论(0) 推荐(0)
Leetcode: Encode String with Shortest Length && G面经
摘要: DP: Initially I think of 1D DP, dp[i] stands for the shortest string of first i characters, then: dp[i] = minLen{dp[k] + encode(substring(k+1, i))} th 阅读全文
posted @ 2016-12-23 06:25 neverlandly 阅读(2173) 评论(0) 推荐(0)
Leetcode: Concatenated Words
摘要: Scan through array and DP: We iterate through each word and see if it can be formed by using other words. The subproblem is Word Break I. But it is a 阅读全文
posted @ 2016-12-23 01:40 neverlandly 阅读(1340) 评论(0) 推荐(0)
博客园  ©  2004-2026
浙公网安备 33010602011771号 浙ICP备2021040463号-3