1、为什么Java中1000==1000为false而100==100为true? 当 int 类型值 在 -127 到 127 之间,两个变量的引用地址是相同的。Integer.java 类,有一个内部私有类,IntegerCache.java缓存了从-128到127之间的所有的整数对象。 Int ...
分类:
编程语言 时间:
2020-11-08 16:41:31
阅读次数:
18
delphi TStringList 用法详解 //TStringList 常用方法与属性 :var List: TStringList; i: Integer;begin List := TStringList.Create; List.Add('Strings1'); {添加} List.Add ...
package LeetCode_153 /** * 153. Find Minimum in Rotated Sorted Array https://leetcode.com/problems/find-minimum-in-rotated-sorted-array/ Suppose an ar ...
分类:
其他好文 时间:
2020-11-01 10:11:19
阅读次数:
19
状态转移方程的定义为:dp( K,i ) 表示经历 K 站乘坐到 flight[i] 航班终点的最低票价。 因为 flight 中的元素存在前后置关系,所以乘坐某航班的上一航班的集合是可以确定的。 dp( K,i ) = Math.min( dp( K-1,j ) ),其中 j 为可以作为上一趟航班 ...
分类:
其他好文 时间:
2020-11-01 10:08:43
阅读次数:
15
* Created by cws */ @Data public class ResultVM implements Serializable { private static final long serialVersionUID = 1L; public static final Integer ...
分类:
其他好文 时间:
2020-10-31 01:21:33
阅读次数:
20
You are given a sorted unique integer array nums. Return the smallest sorted list of ranges that cover all the numbers in the array exactly. That is, ...
分类:
其他好文 时间:
2020-10-30 11:55:20
阅读次数:
20
当我按照官方的思路写出代码,提交后并未通过,查看错误,发现算法错误的将[2147483647,-2147483648]也视为连续的整数了,这是因为我没有考虑到int类型的边界。将代码稍加修改,即成功提交 //哈希表,建议看官方的题解,尤其是演示动画 class Solution { public i ...
分类:
其他好文 时间:
2020-10-29 10:20:41
阅读次数:
23
//通过哈希表来查重 class Solution { public boolean containsDuplicate(int[] nums) { Set<Integer> set = new HashSet<>(); for(int i = 0;i < nums.length;i++){ if( ...
分类:
其他好文 时间:
2020-10-29 10:06:06
阅读次数:
17
总述 宏的使用,大家经常会用,但是一般只是简单定义一个符号常量,类似于#define WHEEL_SCALE_MM 0.53f、 #define LOG_I(tag, text_fmt, ...) log_i(tag, text_fmt, ##VA_ARGS) ,但是除此之外还有宏还有个##粘贴作用 ...
分类:
其他好文 时间:
2020-10-27 11:49:58
阅读次数:
26
class Solution { public List<Integer> postorderTraversal(TreeNode root) { //一般解法,前序遍历后,翻转下结果集,注意下 与前序遍历的进栈顺序不一样 //(前序) 根左右 --> 变为 根右左 --> 翻转 左右根 (后续) ...
分类:
其他好文 时间:
2020-10-27 11:40:04
阅读次数:
20