摘要: 原版 sorted [抄题]: [思维问题]: 存sum - nums[i](补集),若出现第二次则调出 [一句话思路]: hashmap中,重要的数值当做key,角标当做value. [画图]: [一刷]: [总结]: [复杂度]:n/n [英文数据结构,为什么不用别的数据结构]: 2根指针 n^ 阅读全文
posted @ 2017-12-13 16:24 苗妙苗 阅读(256) 评论(0) 推荐(0) 编辑
摘要: [抄题]: 给定一个整数数组,找到和为零的子数组。你的代码应该返回满足要求的子数组的起始位置和结束位置.给出 [-3, 1, 2, -3, 4],返回[0, 2] 或者 [1, 3]. [思维问题]: 老是想着数组双重循环用枚举法,想不到任何别的数据结构。 用hashmap的好处:一个数据结构可以包 阅读全文
posted @ 2017-12-12 09:49 苗妙苗 阅读(289) 评论(0) 推荐(0) 编辑
摘要: 一 [抄题]: If you were only permitted to complete at most one transaction (ie, buy one and sell one share of the stock), design an algorithm to find the 阅读全文
posted @ 2017-12-10 16:07 苗妙苗 阅读(216) 评论(0) 推荐(0) 编辑
摘要: [抄题]: Find the contiguous subarray within an array (containing at least one number) which has the largest sum. For example, given the array [-2,1,-3,4 阅读全文
posted @ 2017-12-10 08:59 苗妙苗 阅读(225) 评论(0) 推荐(0) 编辑
摘要: http://zhangnai.xin/2016/09/20/LeetCode-Framework/ 目录结构: LeetCode ——项目名称,方便Eclipse内置Git对代码进行管理和多终端同步 pid1 ——题目包,每个题目封装在一个单独的包中,包名用LeetCode题目编号表示 Solut 阅读全文
posted @ 2017-12-09 16:31 苗妙苗 阅读(5776) 评论(1) 推荐(0) 编辑
摘要: Array Data Structure ‘Recent Articles’ on Arrays Topic : Introduction Array Rotations Arrangement Rearrangement Order Statistics Range Queries Searchi 阅读全文
posted @ 2017-12-09 09:02 苗妙苗 阅读(689) 评论(0) 推荐(0) 编辑
摘要: [抄题]: There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complex 阅读全文
posted @ 2017-12-08 12:30 苗妙苗 阅读(141) 评论(0) 推荐(0) 编辑
摘要: Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element. For exam 阅读全文
posted @ 2017-12-07 11:08 苗妙苗 阅读(183) 评论(0) 推荐(0) 编辑
摘要: 不重复的: 方法一 [一句话思路]:排序之后用归并。 [一刷]: [二刷]: 格式上:for循环, else 后面也要加花括号 [总结]:结果中有几个数要看index加到了多少 [复杂度]:sort n*logn, merge n/1 [英文数据结构]:Array sort, array merge 阅读全文
posted @ 2017-11-30 21:23 苗妙苗 阅读(140) 评论(0) 推荐(0) 编辑
摘要: [抄题]: [暴力解法]: 时间分析: 空间分析: [优化后]: 时间分析: 空间分析: [奇葩输出条件]: [奇葩corner case]: [思维问题]: [英文数据结构或算法,为什么不用别的数据结构或算法]: [一句话思路]: [输入量]:空: 正常情况:特大:特小:程序里处理到的特殊情况:异 阅读全文
posted @ 2017-11-29 22:36 苗妙苗 阅读(567) 评论(0) 推荐(0) 编辑