• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
neverlandly
博客园    首页    新随笔    联系   管理    订阅  订阅

随笔分类 -  Leetcode

上一页 1 ··· 28 29 30 31 32
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)
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 阅读(952) 评论(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 ··· 28 29 30 31 32
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3