CCSU团队训练赛 H - Billionaires URAL - 1650 ? You probably are aware that Moscow holds the first place in the world with respect to the number of billionai ...
分类:
其他好文 时间:
2020-06-28 22:22:44
阅读次数:
149
借助全局变量 max 存储全局最优解,遍历以所有节点为头结点的子树。 static final int LEFT = -1; static final int RIGHT = 1; int max = 0; public final int longestZigZag(TreeNode root) ...
分类:
其他好文 时间:
2020-06-28 22:15:48
阅读次数:
67
package LeetCode_31 /** * 31. Next Permutation * https://leetcode.com/problems/next-permutation/description/ * Implement next permutation, which rearr ...
分类:
其他好文 时间:
2020-06-28 18:53:29
阅读次数:
51
Q: 为啥fn()调用不了函数?而arr=[...fn()]却运行了啊?不是next才行? function*fn(){ console.log(1); yield 1+1; console.log(2); yield 2-2; } // fn(); const arr=[...fn()]; con ...
分类:
其他好文 时间:
2020-06-28 09:53:13
阅读次数:
65
1.理论知识:什么是生成器? 生成器的本质就是迭代器。生成器和迭代器也有不同,唯一的不同就是:迭代器都是Python给你提供的已经写好的工具或者通过数据转化得来的,(比如文件句柄,iter([1,2,3])。生成器是需要我们自己用python代码构建的工具。最大的区别也就如此了。 2.生成器的构建方 ...
分类:
编程语言 时间:
2020-06-28 09:43:39
阅读次数:
88
/** * ResultSet:结果集。封装了使用JDBC进行查询的结果。 * 1. 调用Statement对象的executeQuery(sql)方法 * 2. ResultSet返回的实际上就是一张数据表。有一个指针指向数据表的第一行的前面。 * 可以调用next()方法检测下一行是否有效。若有 ...
分类:
数据库 时间:
2020-06-27 19:55:20
阅读次数:
62
MySQL数据库之连接查询 JOIN 对比 操作符名称描述 INNER JOIN 如果表中有至少一个匹配,则返回行 LEFT JOIN 即使右表中没有匹配,也从左表中返回所有的行 RIGHT JOIN 即使左表中没有匹配,也从右表中返回所有的行 七种Join 示例 /*连接查询 如需要多张数据表的数 ...
分类:
数据库 时间:
2020-06-27 15:52:49
阅读次数:
58
使用C#语法编写程序时,我们需要截取一个字符串左边或右边的若干个字符,该如何操作呢? 在VB中可以使用left或right函数实现,C#中没有提供这样的函数呢?答案是没有。但是,C#中提供Substring方法可以实现相关功能。 用法一: String.Substring 方法 (startInde ...
给定一棵大小为 \(n\) 的树,每个结点都有颜色。 定义 \(s(i, j)\) 为从 \(i\) 到 \(j\) 的不同颜色数量以及 \(sum_i = \sum\limits_{j= 1}^ns(i,j)\)。 求出所有的 \(sum_i\)。 较为复杂的点分治题。 也可以用差分 \(O(n) ...
分类:
其他好文 时间:
2020-06-27 13:15:18
阅读次数:
52
题目 https://www.luogu.com.cn/problem/P4913 代码 #include<iostream> #include<cstdio> struct node { int left; int right; }list[1000001]; int depth = 0; voi ...
分类:
其他好文 时间:
2020-06-27 13:11:54
阅读次数:
75