Minimum Size Subarray Sum Given an array of n positive integers and a positive integer s, find the minimal length of a contiguous subarray of which th ...
分类:
其他好文 时间:
2020-07-16 18:17:25
阅读次数:
57
三个方面去理解“重写equals为什么要重写hashcode”: 1.Object中hashCode()的源码注释 1. 源码 hashCode()的注释的最后一段的括号中写道:将对象的地址值映射为integer类型的哈希值。 2. 源码 equals()的注释:当我们将equals方法重写后有必要 ...
分类:
其他好文 时间:
2020-07-16 11:45:29
阅读次数:
53
problem 1394. Find Lucky Integer in an Array solution #1: 使用哈希表; 使用哈希表记录数组元素和freq,然后判断是否相等,且取最大值; 注意 1. 最大值可以由下标一次递减隐性表示; 2. 数值的范围是1-500; 参考 1. leetco ...
分类:
其他好文 时间:
2020-07-16 00:22:19
阅读次数:
51
反转字符: //反转一串字符 export default (str)=>{ let arr=str.split(' ') let result=arr.map(item=>{ return item.split('').reverse().join('') }) return result.joi ...
分类:
其他好文 时间:
2020-07-16 00:14:19
阅读次数:
58
Description A balanced number is a non-negative integer that can be balanced if a pivot is placed at some digit. More specifically, imagine each digit ...
分类:
其他好文 时间:
2020-07-16 00:05:52
阅读次数:
79
Description A wqb-number, or B-number for short, is a non-negative integer whose decimal form contains the sub- string "13" and can be divided by 13. ...
分类:
其他好文 时间:
2020-07-15 23:20:22
阅读次数:
96
地址:https://leetcode-cn.com/problems/hamming-distance/ <?php /** 两个整数之间的汉明距离指的是这两个数字对应二进制位不同的位置的数目。 给出两个整数 x 和 y,计算它们之间的汉明距离。 注意: 0 ≤ x, y < 231. 示例: 输 ...
分类:
其他好文 时间:
2020-07-15 22:55:36
阅读次数:
57
泛型是泛+型,目的是为了节省代码的重复,可以复用代码。 场景: 定义了两个方法(函数) public int DisplayMyInteger(int myInt) { return myInt; } public string DisplayMyString(string myStr) { ... ...
给定两个字符串形式的非负整数 num1 和num2 ,计算它们的和。 注意: num1 和num2 的长度都小于 5100.num1 和num2 都只包含数字 0-9.num1 和num2 都不包含任何前导零。你不能使用任何內建 BigInteger 库, 也不能直接将输入的字符串转换为整数形式。 ...
分类:
其他好文 时间:
2020-07-15 01:10:57
阅读次数:
59
Given an array of integers and an integer k, you need to find the number of unique k-diff pairs in the array. Here a k-diff pair is defined as an inte ...
分类:
其他好文 时间:
2020-07-15 01:00:03
阅读次数:
73