Spurs

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

2017年8月13日

摘要: 1. Two Sum 人家媳妇: time $O(n)$, space $O(n)$ 方法中巧妙使用map,一次遍历完成任务. 遍历数组时,若未在map中找到想要的元素,则把数组中当前元素投入map.(注key=数组元素值,val=该元素indx) c++ vector twoSum(vector 阅读全文
posted @ 2017-08-13 13:49 英雄与侠义的化身 阅读(112) 评论(0) 推荐(0) 编辑

摘要: Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in or 阅读全文
posted @ 2017-08-13 13:40 英雄与侠义的化身 阅读(174) 评论(0) 推荐(0) 编辑

摘要: Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length. Do not allocate extra space fo 阅读全文
posted @ 2017-08-13 13:38 英雄与侠义的化身 阅读(105) 评论(0) 推荐(0) 编辑

摘要: Given input array , Your function should return length = 2, with the first two elements of nums being 2. 就是把不是3的元素往前移动至队首,再返回不是3的元素个数. $O(n)$ time, $O 阅读全文
posted @ 2017-08-13 13:36 英雄与侠义的化身 阅读(94) 评论(0) 推荐(0) 编辑

摘要: Author: Zhong Liang Xiang Start from: August 7th, 2017 这个题为 连滚带爬的Leetcode填坑记录 就这么开始了. 网上看了看, 一堆小伙从2014年就开始弄这个东西了,可自己那时候也不知道整这个东西啊. 啥也不说了,开整吧. 本系列,就是我自 阅读全文
posted @ 2017-08-13 13:28 英雄与侠义的化身 阅读(106) 评论(0) 推荐(0) 编辑