• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
neverlandly
博客园    首页    新随笔    联系   管理    订阅  订阅
上一页 1 ··· 17 18 19 20 21
2014年5月4日
Leetcode: Minimum Depth of Binary Tree
摘要: Given a binary tree, find its minimum depth.The minimum depth is the number of nodes along the shortest path from the root node down to the nearest le... 阅读全文
posted @ 2014-05-04 22:32 neverlandly 阅读(300) 评论(0) 推荐(0)
2014年5月3日
Leetcode: Balanced Binary Tree
摘要: 很锻炼DP/recursive思路的一道题,个人感觉DP/recursive算是比较难写的题目了。这道题解法的巧妙之处在于巧用-1,并且使用临时存储,节省了很多开支。这道题同时也在Career Cup上面出现过 这道题我两次调试通过,第一次错是因为input{}, output false, exp 阅读全文
posted @ 2014-05-03 06:21 neverlandly 阅读(306) 评论(0) 推荐(0)
Leetcode: Maximum Depth of Binary Tree
摘要: Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest le... 阅读全文
posted @ 2014-05-03 06:11 neverlandly 阅读(249) 评论(0) 推荐(0)
Leetcode: Same Tree
摘要: Given two binary trees, write a function to check if they are equal or not. Two binary trees are considered equal if they are structurally identical and the nodes have the same value. 1 public... 阅读全文
posted @ 2014-05-03 06:01 neverlandly 阅读(356) 评论(0) 推荐(1)
Leetcode: Remove Duplicates from Sorted List
摘要: Given a sorted linked list, delete all duplicates such that each element appear only once.For example,Given 1->1->2, return 1->2.Given 1->1->2->3->3, ... 阅读全文
posted @ 2014-05-03 05:56 neverlandly 阅读(277) 评论(0) 推荐(0)
2014年5月2日
Leetcode: Plus One
摘要: Given a non-negative number represented as an array of digits, plus one to the number.The digits are stored such that the most significant digit is at... 阅读全文
posted @ 2014-05-02 05:22 neverlandly 阅读(430) 评论(0) 推荐(0)
Leetcode: Length of Last Word
摘要: Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the length of last word in the string.If the last word ... 阅读全文
posted @ 2014-05-02 05:17 neverlandly 阅读(256) 评论(0) 推荐(0)
2014年5月1日
Leetcode: Remove Elements
摘要: Given an array and a value, remove all instances of that value in place and return the new length.The order of elements can be changed. It doesn't mat... 阅读全文
posted @ 2014-05-01 23:02 neverlandly 阅读(949) 评论(0) 推荐(0)
Leetcode: Remove Duplicates from Sorted Array
摘要: 没有想通为什么这个简单的问题竟然不是那么简单,太小看它了,以下是别人的很不错的solution: Solution: 做法是维护两个指针,一个保留当前有效元素的长度,一个从前往后扫,然后跳过那些重复的元素。因为数组是有序的,所以重复元素一定相邻,不需要额外记录。时间复杂度是O(n),空间复杂度O(1 阅读全文
posted @ 2014-05-01 12:24 neverlandly 阅读(343) 评论(0) 推荐(0)
上一页 1 ··· 17 18 19 20 21
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3