摘要:1. Two Sum 人家媳妇: time $O(n)$, space $O(n)$ 方法中巧妙使用map,一次遍历完成任务. 遍历数组时,若未在map中找到想要的元素,则把数组中当前元素投入map.(注key=数组元素值,val=该元素indx) c++ vector twoSum(vector
阅读全文
随笔分类 - Leetcode
摘要: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
阅读全文
摘要: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
阅读全文
摘要:Given input array , Your function should return length = 2, with the first two elements of nums being 2. 就是把不是3的元素往前移动至队首,再返回不是3的元素个数. $O(n)$ time, $O
阅读全文
摘要:Author: Zhong Liang Xiang Start from: August 7th, 2017 这个题为 连滚带爬的Leetcode填坑记录 就这么开始了. 网上看了看, 一堆小伙从2014年就开始弄这个东西了,可自己那时候也不知道整这个东西啊. 啥也不说了,开整吧. 本系列,就是我自
阅读全文

浙公网安备 33010602011771号