里氏替换原则 解决类继承(对象)代码耦合性问题 继承关系中 父类修改 会影响子类 基本介绍1) 里氏替换原则(Liskov Substitution Principle)在1988年,由麻省理工学院的以为姓里的女士提出的。2) 如果对每个类型为T1的对象o1,都有类型为T2的对象o2,使得以T1定义 ...
分类:
其他好文 时间:
2020-02-14 16:57:02
阅读次数:
93
题目描述: 给定一个整数数组 nums 和一个目标值 target,请你在该数组中找出和为目标值的那 两个 整数,并返回他们的数组下标。 你可以假设每种输入只会对应一个答案。但是,你不能重复利用这个数组中同样的元素。 示例: 给定 nums = [2, 7, 11, 15], target = 9 ...
分类:
编程语言 时间:
2020-02-14 11:19:05
阅读次数:
59
https://leetcode-cn.com/problems/add-two-numbers/ ListNode root = new ListNode(0); ListNode cur = root; int retain = 0; while (l1!=null || l2!=null || ...
分类:
其他好文 时间:
2020-02-05 20:18:39
阅读次数:
70
int [] two_num(int [] nums,int target){ HashMap<Integer, Integer> num_indx = new HashMap<Integer, Integer>(); int [] ans = new int [2]; for(int i=0;i< ...
分类:
其他好文 时间:
2020-02-05 18:42:01
阅读次数:
60
给定一个整数数组 nums 和一个目标值 target,请你在该数组中找出和为目标值的那 两个 整数,并返回他们的数组下标。 你可以假设每种输入只会对应一个答案。但是,你不能重复利用这个数组中同样的元素。 示例: 给定 nums = [2, 7, 11, 15], target = 9 因为 num ...
分类:
编程语言 时间:
2020-02-01 10:33:05
阅读次数:
190
167. Two Sum II Input array is sorted(两数之和 II 输入有序数组) 链接 https://leetcode cn.com/problems/two sum ii input array is sorted 题目 给定一个已按照升序排列?的有序数组,找到两个数使 ...
分类:
其他好文 时间:
2020-01-31 14:06:24
阅读次数:
72
题目描述: Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would h ...
分类:
其他好文 时间:
2020-01-31 12:38:32
阅读次数:
93
1、两数之和(难度:简单) (1)Java数组 动态初始化:数据类型[] 数组名称=new 数据类型 [长度] 键盘输入方法: 方法一(不限制输入数组的长度): Scanner sc = new Scanner(System.in); String str = sc.next().toString( ...
分类:
编程语言 时间:
2020-01-30 17:02:56
阅读次数:
72
链接: "LeetCode653" 给定一个二叉搜索树和一个目标结果,如果 BST 中存在两个元素且它们的和等于给定的目标结果,则返回 true。 相关标签: 哈希表 类似于求两数之和,我们只需要在遍历二叉树过程中寻找是否存在有数为k 已经遍历到的数即可。 代码如下: python: C++: ...
分类:
其他好文 时间:
2020-01-28 22:58:39
阅读次数:
75
1.两数之和 给定一个整数数组 nums 和一个目标值 target,请你在该数组中找出和为目标值的那 两个 整数,并返回他们的数组下标。 你可以假设每种输入只会对应一个答案。但是,你不能重复利用这个数组中同样的元素。 示例: 给定 nums = [2, 7, 11, 15], target = 9 ...
分类:
其他好文 时间:
2020-01-26 19:02:20
阅读次数:
53