• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
neverlandly
博客园    首页    新随笔    联系   管理    订阅  订阅
2015年1月22日
Leetcode: Longest Substring with At Most Two Distinct Characters
摘要: 方法一:用HashMap, map里面存元素及其出现次数。维护一个最大长度。用两个指针,右指针一直走到出现3个dinstinct character为止。然后调整左指针删元素,直接从左往右逐个字符的删除,一直删到某个字符不会再出现。判断字符被删光就看次数是否减为了0. 采用方法: 这里每个元素都会进 阅读全文
posted @ 2015-01-22 13:17 neverlandly 阅读(400) 评论(0) 推荐(0)
Leetcode: Read N Characters Given Read4 II - Call multiple times
摘要: 这道题跟I不一样在于,read函数可能多次调用,比如read(buf,23)之后又read(buf, 25), 第一次调用时的buffer还没用完,还剩一个char在buffer里,第二次拿出来接着用,这样才能保证接着上次读的地方继续往下读。 1. 所以应该设置这4个char的buffer为inst 阅读全文
posted @ 2015-01-22 07:35 neverlandly 阅读(2821) 评论(0) 推荐(0)
Summary: Stack Overflow Error
摘要: What is a stack overflow error?Parameters and local variables are allocated on the stack (with reference types the object lives on the heap and a vari... 阅读全文
posted @ 2015-01-22 06:47 neverlandly 阅读(338) 评论(0) 推荐(0)
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3