• 博客园logo
  • 会员
  • 周边
  • 新闻
  • 博问
  • 闪存
  • 众包
  • 赞助商
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
ying_vincent
博客园    首页    新随笔    联系   管理    订阅  订阅
2016年11月24日
LeetCode: Product of Array Except Self
摘要: Dynamic Programming 阅读全文
posted @ 2016-11-24 16:06 ying_vincent 阅读(121) 评论(0) 推荐(0)
LeetCode:Two Sum II
摘要: 1 public class Solution { 2 public int[] twoSum(int[] numbers, int target) { 3 int left = 0; 4 int right = numbers.length - 1; 5 while (left < right) { 6 ... 阅读全文
posted @ 2016-11-24 15:45 ying_vincent 阅读(135) 评论(0) 推荐(0)
LeetCode: Minimum Moves to Equal Array Elements II
摘要: 这题一开始以为是求平均数,后来发现是求中位数,如果是偶数大小随便取中间两个中任何一个都可以 阅读全文
posted @ 2016-11-24 15:39 ying_vincent 阅读(103) 评论(0) 推荐(0)
LeetCode: Invert Binary Tree
摘要: 1 /** 2 * Definition for a binary tree node. 3 * public class TreeNode { 4 * int val; 5 * TreeNode left; 6 * TreeNode right; 7 * TreeNode(int x) { val = x; } 8 * } 9 ... 阅读全文
posted @ 2016-11-24 15:06 ying_vincent 阅读(111) 评论(0) 推荐(0)
LeetCode: Find the Difference
摘要: ASCII就只有256位,用一个array就可以了 阅读全文
posted @ 2016-11-24 14:36 ying_vincent 阅读(195) 评论(0) 推荐(0)
LeetCode: Queue Reconstruction by Height
摘要: 这题的关键点在于对数组的重排序方法,高度先由高到低排列不会影响第二个参数,因为list.add的方法在指定index后面插入,因此对于同高的人来说需要对第二个参数由低到高排,具体代码如下 int[][] ans = (int[][])pList.toArray();会报错,只能遍历赋值了 阅读全文
posted @ 2016-11-24 11:19 ying_vincent 阅读(189) 评论(0) 推荐(0)
博客园  ©  2004-2026
浙公网安备 33010602011771号 浙ICP备2021040463号-3