比较的接口Comparable,提供了一个比较的方法,所有实现该接口的类,都动态的实现了该比较方法。实际上Java中除了比较一个接口外,还提供了一个接口,该接口也是具有比较的功能,但该接口注重的却是比较容器,然后对其排序,这就是Comparator Map<String,Integer> map = ...
分类:
编程语言 时间:
2020-07-19 23:29:54
阅读次数:
69
851. 喧闹和富有 描述: 思路:深度优先(带记忆)。 这个题有点秒。。 853. 车队 描述: 思路: 我们首先对这些车辆按照它们的起始位置降序排序,并且用 (target - position) / speed 计算出每辆车在不受其余车的影响时,行驶到终点需要的时间。对于相邻的两辆车 S 和 ...
分类:
其他好文 时间:
2020-07-19 23:17:22
阅读次数:
92
class Solution { public List<Integer> getRow(int rowIndex) { Integer[] res = new Integer[rowIndex+1]; Arrays.fill(res,1); for(int i = 1; i <= rowIndex ...
分类:
编程语言 时间:
2020-07-19 17:46:05
阅读次数:
79
String转换为int String 字符串转整型 int 有以下两种方式: Integer.parseInt(str) Integer.valueOf(str).intValue() 注意:Integer 是一个类,是 int 基本数据类型的封装类。后续会讲到。 例如下面代码所示: public ...
分类:
编程语言 时间:
2020-07-19 16:11:11
阅读次数:
63
学习内容:包装类 1.Integer型包装类 代码实现: public class Integer包装类 { public static void main(String[] args) { // TODO 自动生成的方法存根Integer a1=new Integer(15);//创建方法一Int ...
分类:
编程语言 时间:
2020-07-18 22:44:51
阅读次数:
81
agc041_d Problem Scores https://atcoder.jp/contests/agc041/tasks/agc041_d Tutorial https://img.atcoder.jp/agc041/editorial.pdf 由于$A_i \le A_{i+1}$,所以设 ...
分类:
其他好文 时间:
2020-07-18 22:13:51
阅读次数:
61
Given a non-negative integer N, your task is to compute the sum of all the digits of N, and output every digit of the sum in English. Input Specificat ...
分类:
其他好文 时间:
2020-07-18 21:49:07
阅读次数:
59
1.使用wait()/notifyAll实现生产者和消费者 1 /** 2 * 锁对象类 3 * 协作类 4 */ 5 public class MyQueue { 6 private Queue<Integer> queue; 7 private int limit; 8 9 public MyQ ...
分类:
编程语言 时间:
2020-07-18 15:30:39
阅读次数:
71
1、准备数据 1) 创建索引 2) 创建mapping JSON数据如下 { "properties": { "id": { "type": "long" }, "age": { "type": "integer" }, "username": { "type": "keyword" }, "nic ...
分类:
其他好文 时间:
2020-07-18 15:24:23
阅读次数:
90
一,为什么要引入泛型? 1,可以统一集合中的数据类型 2,可以减少强制类型转换 3,泛型其实就是编译器检查类型 二,泛型语法如何实现? E指的是element,可以是各种各样的类型 1,Map使用泛型 // maps 中的key只能是String类型,value只能是Integer类型 Map<St ...
分类:
编程语言 时间:
2020-07-18 11:32:31
阅读次数:
78