• 博客园logo
  • 会员
  • 周边
  • 新闻
  • 博问
  • 闪存
  • 众包
  • 赞助商
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
neverlandly
博客园    首页    新随笔    联系   管理    订阅  订阅
2016年12月13日
Leetcode: Find All Numbers Disappeared in an Array
摘要: Given an array of integers where 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once. Find all the elements of [1, n] inclusive that do not appear in this array. Cou... 阅读全文
posted @ 2016-12-13 12:36 neverlandly 阅读(438) 评论(0) 推荐(0)
Leetcode: Find All Duplicates in an Array
摘要: my solution: put integer A[i] at index A[i]-1 unless A[i] already equals i +1 or A[i] == A[A[i]-1] later scan again if at index i, A[i] != i+1, then A 阅读全文
posted @ 2016-12-13 12:12 neverlandly 阅读(328) 评论(0) 推荐(0)
Leetcode: Minimum Genetic Mutation
摘要: the same with word ladder 写的时候语法上出了一些问题 第5行不用给char数组赋大小 第20行用stringbuilder的时候曾经写成:String afterMutation = new StringBuilder(cur).setCharAt(i, c).toStri 阅读全文
posted @ 2016-12-13 11:03 neverlandly 阅读(1080) 评论(0) 推荐(0)
Leetcode: Island Perimeter
摘要: You are given a map in form of a two-dimensional integer grid where 1 represents land and 0 represents water. Grid cells are connected horizontally/vertically (not diagonally). The grid is completely... 阅读全文
posted @ 2016-12-13 08:37 neverlandly 阅读(299) 评论(0) 推荐(0)
Leetcode: Can I Win
摘要: refer to https://discuss.leetcode.com/topic/68896/java-solution-using-hashmap-with-detailed-explanation After solving several "Game Playing" questions 阅读全文
posted @ 2016-12-13 07:59 neverlandly 阅读(1148) 评论(0) 推荐(0)
Leetcode: Repeated Substring Pattern
摘要: 这道题应该没法用DP等解,只能brute force 或者 KMP(为深究) BruteForce, Best Solution for now except KMP 作为Encode String with Shortest Length的subproblem KMP解法未研究,https://d 阅读全文
posted @ 2016-12-13 04:43 neverlandly 阅读(731) 评论(0) 推荐(0)
Leetcode: Assign Cookies
摘要: Solution 1: Greedy, Time:O(nlogn) Just assign the cookies starting from the child with less greediness to maximize the number of happy children . Solu 阅读全文
posted @ 2016-12-13 02:23 neverlandly 阅读(336) 评论(0) 推荐(0)
博客园  ©  2004-2026
浙公网安备 33010602011771号 浙ICP备2021040463号-3