原题链接 1 class Solution: 2 ans = 0 3 def sumOfLeftLeaves(self, root: TreeNode) -> int: 4 def dfs(root,flag): 5 if not root:return 6 if not root.left and ...
分类:
其他好文 时间:
2021-01-26 11:58:52
阅读次数:
0
map()函数 map()是 Python 内置的高阶函数,它接收一个函数 f 和一个 list,并通过把函数 f 依次作用在 list 的每个元素上,得到一个新的 list 并返回。 1、当seq只有一个时,将函数func作用于这个seq的每个元素上,并得到一个新的seq。 例如,对于list [ ...
分类:
编程语言 时间:
2021-01-26 11:49:25
阅读次数:
0
1、选择语句 if if else switch 2、循环语句 for while do while 3、转向语句 break continue 4、返回语句 return ...
分类:
其他好文 时间:
2021-01-26 11:44:42
阅读次数:
0
1 var obj = {}; 2 3 var f = function () { 4 return this; 5 }; 6 7 f() window // true 8 f.call(obj) obj // true f的内部有this this的指向不唯一,可变化 在全局环境运行f,this指 ...
分类:
其他好文 时间:
2021-01-25 11:37:17
阅读次数:
0
Problem LeetCode Given the root of a binary tree, return the sum of every tree node's tilt. The tilt of a tree node is the absolute difference between ...
分类:
编程语言 时间:
2021-01-25 11:29:21
阅读次数:
0
题意: 戳这里 分析: 前置芝士 : 生成函数 多项式EXP 将题目拆成两问: 前缀和 一次前缀和操作 \(\sum_{j<i}a_j\to a_i\) 等价于将 \(a\) 序列的 OGF 乘了一个 \(1+x+x^2+x^3\dots x^n\) 即 \(\frac{1}{1-x}\),\(an ...
分类:
其他好文 时间:
2021-01-25 11:21:27
阅读次数:
0
shader之threejs应用 shader用作编写threejs自定义材质的着色器。 效果: 代码: <template> <div class="threeModel"> <div id="modelBox"></div> </div> </template> <script> import ...
分类:
Web程序 时间:
2021-01-25 11:14:53
阅读次数:
0
一、JAVA8新特性lambda表达式 ()->{ return 5;} 二、方法引用,将方法作为参数传入: foreach(System.out::printLn) 三、函数式接口 @FunctionalInterface interface GreetingService { void sayM ...
分类:
编程语言 时间:
2021-01-25 11:12:33
阅读次数:
0
输入正整数a,b,c,输出a/b的小数形式,精确到小数点后c位。a,b<=10^6,c<=100/输入包含多组数据,结束标记为a=b=c=0 样例输入: 1 6 4 0 0 0 样例输出: case 1 : 0.1667 这道题要注意scanf中和printf中的%*lf这类*的区别,在scanf中 ...
分类:
其他好文 时间:
2021-01-25 11:05:43
阅读次数:
0
Introduction 快速傅里叶变换(Fast Fourier Transform,FFT)是一种可在 \(O(n \log n)\) 时间内完成的离散傅里叶变换 (Discrete Fourier Transform,DFT) 的算法,用来实现将信号从原始域(通常是时间或空间)到频域的互相转化 ...
分类:
其他好文 时间:
2021-01-25 11:03:37
阅读次数:
0