json模快写入内容优点: 写入的内容与原python数据形式一致,常常用于两个文件的数据交换。 看看示例: 我们先导入json模块: import json 下面将: [1,2,3,4,5,6,7,8,9] >>写入文件>>number.json 例: numbers=[1,2,3,4,5,6,7 ...
分类:
Web程序 时间:
2020-07-09 19:35:20
阅读次数:
78
MYSQL中没有row_number()over(partition by order by ),如何排序后进行筛选? 方法一: select OperatorID,sum(cnt) as '总人数',sum(case when Quality=1 then cnt else 0 end ) as ...
分类:
数据库 时间:
2020-07-09 19:32:17
阅读次数:
77
泛型 基本 function add<t>(arg1: T, arg2: T): T { return arg1 + arg2 } // add<number>(1,'0') X 泛型接口 function add<T>(arg1:T,arg2:T):T { return arg1 + arg2 } ...
分类:
其他好文 时间:
2020-07-09 19:25:40
阅读次数:
66
Description Given an array of integers A, find the number of triples of indices (i, j, k) such that: 0 <= i < A.length 0 <= j < A.length 0 <= k < A.le ...
分类:
其他好文 时间:
2020-07-09 19:24:31
阅读次数:
58
题目描述: 给定一个非空二叉树,返回其最大路径和。 本题中,路径被定义为一条从树中任意节点出发,达到任意节点的序列。该路径至少包含一个节点,且不一定经过根节点。 示例 1: 输入: [1,2,3] 1 / \ 2 3 输出: 6示例 2: 输入: [-10,9,20,null,null,15,7] ...
分类:
其他好文 时间:
2020-07-09 19:10:05
阅读次数:
51
因为题目已知至少要k-2个 假设我们取了k个,使得答案最大 那么因为对于每个数来说至少k-2个数在这位是1 因此我们只要任意选三个数,都能保证在每一位上都有至少一个数为1 #include<bits/stdc++.h> using namespace std; typedef long long l ...
分类:
其他好文 时间:
2020-07-09 15:12:45
阅读次数:
67
一、traceback模块(import traceback) 1. traceback.print_exc() # 直接打印出来 traceback.print_exc(file=open("test.txt","a+") # 若没有test.txt文件,则新建一个,写入调试信息,若存在,则在后面 ...
分类:
编程语言 时间:
2020-07-09 15:01:20
阅读次数:
76
Maximum Gap Given an unsorted array, find the maximum difference between the successive elements in its sorted form. Return 0 if the array contains le ...
分类:
其他好文 时间:
2020-07-08 15:25:35
阅读次数:
52
8th 字符串转换整数 (atoi) 字符串模式匹配 这种题目极易写出臃肿的代码,我们需要明确具体的条件,并充分考虑细节。(否则会被样例虐爆) 这里有一个常用的判断溢出条件的方法,在之前的题目中也有出现。 对于正数: if(number > Integer.MAX_VALUE / 10 || (nu ...
分类:
其他好文 时间:
2020-07-08 15:02:40
阅读次数:
61
/* 1. 定义一个函数式接口NumberToString,其中抽象方法String convert(int num),使用注解@FunctionalInterface 2. 在测试类中定义static void decToHex(int num ,NumberToString nts), 该方法的 ...
分类:
编程语言 时间:
2020-07-08 13:13:44
阅读次数:
56