1.Scanner 1 Scanner sc = new Scanner(System.in); 2 String s1 = sc.next(); 3 String s2 = sc.nextLine(); 4 int a = sc.nextInt(); 2.BufferedReader 1 Buff ...
分类:
其他好文 时间:
2020-07-24 16:31:42
阅读次数:
80
1. compose compose(middlewares) // middleware应该是回调, 所有用async-await. middlewares = [async (ctx, next)=>{ log1, await next(), log2 }, async (ctx, next) ...
分类:
Web程序 时间:
2020-07-24 09:52:03
阅读次数:
82
题目来源: http://codeforces.com/problemset/problem/158/A "Contestant who earns a score equal to or greater than the k-th place finisher's score will advan ...
分类:
其他好文 时间:
2020-07-23 23:12:25
阅读次数:
89
方法一:Map加双向链表 class LRUCache { class Node { public int key, val; Node pre,next; public Node() {} public Node(int k, int v) { key = k; val = v; } } priv ...
分类:
其他好文 时间:
2020-07-23 23:01:59
阅读次数:
105
1.图的初始条件[数组表示] //邻接表存储 int node[N]; struct Edge{ int to,next,value; }edges[M]; int flag; //矩阵存储 int dis[N][N]; 已知起点和终点的最短路 dijkstra 算法:选择最短边上的点直到所有点加入 ...
分类:
编程语言 时间:
2020-07-23 09:17:14
阅读次数:
85
1、面向对象的应用(异常处理、文件备份) -装饰器:1、用于扩展原来函数功能的一种函数 2、返回函数的函数 3、在不用更改原函数的代码前提下给函数增加新的功能 带参数的装饰器: -@wraps():使用装饰器后,__name__和__doc__会发生改变,所以使用@wraps装饰器会起到还原的效果 ...
分类:
编程语言 时间:
2020-07-23 09:14:41
阅读次数:
71
问题:输入一个链表,按链表从尾到头的顺序返回一个ArrayList。 解决: #方法一: class Solution: def printListFromTailToHead(self, listNode): # write code here ArrayList = [] while listN ...
分类:
其他好文 时间:
2020-07-23 01:36:18
阅读次数:
62
一:快速失败(fail—fast) 在用迭代器遍历一个集合对象时,如果遍历过程中对集合对象的内容进行了修改(增加、删除、修改),则会抛出Concurrent Modification Exception。 原理:迭代器在遍历时直接访问集合中的内容,并且在遍历过程中使用一个 modCount 变量。集 ...
分类:
编程语言 时间:
2020-07-22 21:03:06
阅读次数:
91
转自:链接 在工作和学习中,经常碰到删除ArrayList里面的某个元素,看似一个很简单的问题,却很容易出bug。不妨把这个问题当做一道面试题目,我想一定能难道不少的人。今天就给大家说一下在ArrayList循环遍历并删除元素的问题。首先请看下面的例子: import java.util.Array ...
分类:
其他好文 时间:
2020-07-22 20:47:57
阅读次数:
86
题目描述 输入两个单调递增的链表,输出两个链表合成后的链表,当然我们需要合成后的链表满足单调不减规则。 1 /* 2 struct ListNode { 3 int val; 4 struct ListNode *next; 5 ListNode(int x) : 6 val(x), next(NU ...
分类:
编程语言 时间:
2020-07-22 20:46:19
阅读次数:
82