2020年3月21日 Design a stack that supports push, pop, top, and retrieving the minimum element in constant time. push(x) Push element x onto stack. pop() ...
分类:
其他好文 时间:
2020-03-21 21:26:35
阅读次数:
59
介绍依赖倒置原则的相关概念,建议reading time : 5mins 一、基本定义 依赖倒置原则(Dependence Inversion Principle,简称DIP)的原始定义是:高层模块不应该依赖低层模块,两者都应该依赖其抽象;抽象不应该依赖细节;细节应该依赖抽象。 Another me ...
分类:
其他好文 时间:
2020-03-21 16:27:02
阅读次数:
72
问题:求给定数列中,最短子数列,使子数列之和>=给定值s Example: Input: s = 7, nums = [2,3,1,2,4,3] Output: 2 Explanation: the subarray [4,3] has the minimal length under the pr ...
分类:
其他好文 时间:
2020-03-21 15:07:57
阅读次数:
98
同https://www.cnblogs.com/habibah-chang/p/12538877.html 附加条件,允许重复数值。 Example 1: Input: [1,3,5] Output: 1 Example 2: Input: [2,2,2,0,1] Output: 0 方法: 思想 ...
分类:
其他好文 时间:
2020-03-21 14:54:19
阅读次数:
57
二叉树中第二小的节点。给定一个非空特殊的二叉树,每个节点都是正数,并且每个节点的子节点数量只能为 2 或 0。如果一个节点有两个子节点的话,那么这个节点的值不大于它的子节点的值。给出这样的一个二叉树,你需要输出所有节点中的第二小的值。如果第二小的值不存在的话,输出 -1 。例子, Example 1 ...
分类:
其他好文 时间:
2020-03-20 09:13:57
阅读次数:
60
Given an array of integers and an integer k, you need to find the minimum size of continuous subarrays whose sum equals to k, and return its length. i ...
分类:
其他好文 时间:
2020-03-18 09:33:00
阅读次数:
42
题目: 给定一个整数数组nums和一个目标值target,请你在该数组中找出和为目标值 的那两个整数,并返回他们的数组下标。 你可以假设每种输入只会对应一个答案。但是,你不能重复利用 这个数组中同样的元素。 示例: 给定 nums = [2, 7, 11, 15], target = 9 因为 nu ...
分类:
其他好文 时间:
2020-03-16 23:54:10
阅读次数:
92
阅读目录: 一. 一个没有使用IoC的例子 二. 当需求发生变动时,非IoC遭遇到的困境 三. 使用IoC彻底解决问题 四. 总结 一、一个没有使用IoC的例子 IoC的全称是Inversion of Control,中文叫控制反转。要理解控制反转,可以看看非控制反转的一个例子。 public cl ...
分类:
其他好文 时间:
2020-03-15 18:56:30
阅读次数:
71
1.GitHub项目地址 https://github.com/k8kiw/WordCount 2.PSP预计时间 PSP2.1 Personal Software Process Stages 预估耗时(分钟) 实际耗时(分钟) Planning 计划 20 · Estimate · 估计这个任务 ...
分类:
其他好文 时间:
2020-03-14 13:00:29
阅读次数:
65
迅哥讲解(说实话没有认真听,不过关系不大) RMQ:Range Minimum Maximum Query 给定一个序列A[1…N],问A[i…j]之间的极值 如果只问一次, 显然是O(N) 标准RMQ问题是:不停的查询同一个序列上的不同区间内的极值 序列A的长度N,一共Q次查询 纯暴力法:O(NQ ...
分类:
其他好文 时间:
2020-03-12 23:16:13
阅读次数:
57