给定一个非空二叉树,返回其最大路径和。 本题中,路径被定义为一条从树中任意节点出发,达到任意节点的序列。该路径至少包含一个节点,且不一定经过根节点。 示例 1: 输入: [1,2,3] 输出: 6 示例 2: 输入: [-10,9,20,null,null,15,7] 输出: 42 来源:力扣(Le ...
分类:
其他好文 时间:
2020-06-21 23:15:04
阅读次数:
47
20. 骰子求和 中文English 扔 n 个骰子,向上面的数字之和为 S。给定 n,请列出所有可能的 S 值及其相应的概率。 样例 样例 1: 输入:n = 1 输出:[[1, 0.17], [2, 0.17], [3, 0.17], [4, 0.17], [5, 0.17], [6, 0.17 ...
分类:
其他好文 时间:
2020-06-21 22:57:28
阅读次数:
46
Given two integers dividend and divisor, divide two integers without using multiplication, division and mod operator. Return the quotient after dividi ...
分类:
其他好文 时间:
2020-06-21 19:56:30
阅读次数:
47
周赛地址(英):Weekly Contest 194 周赛地址(中):第 194 场周赛 仓库地址:week-Leetcode 1486. XOR Operation in an Array Given an integer n and an integer start. Define an arr ...
分类:
其他好文 时间:
2020-06-21 19:54:59
阅读次数:
61
124. 二叉树中的最大路径和 题目来源:力扣(LeetCode)https://leetcode-cn.com/problems/binary-tree-maximum-path-sum 题目 给定一个非空二叉树,返回其最大路径和。 本题中,路径被定义为一条从树中任意节点出发,达到任意节点的序列。 ...
分类:
编程语言 时间:
2020-06-21 19:44:33
阅读次数:
62
1. 计算 100 以内所有能被 3 整除的整数之和 #/bin/bash sum=0 for i in {1..100};doif [ 0 -eq $[$i%3] ];then echo $i let sum+=i; fi echo sum=$sumdone 2. 编写脚本,求 100 以内所有正 ...
分类:
其他好文 时间:
2020-06-21 18:10:19
阅读次数:
48
#include <stdio.h> #include <stdarg.h> /*【第一步】:定义一个使用省略号的函数原型 */ double sum(int lim, ...) { /*【第二步】:声明一个va_list类型的变量ap */ va_list ap; double sum = 0; ...
分类:
编程语言 时间:
2020-06-21 17:51:21
阅读次数:
78
ss=input()n=int(input())c=input() cnt= list(ss).count(c)if cnt<n: print('no')else: lt=ss.split(c) sum=0 for i in range(n): sum+=len(lt[i])+1 print(sum ...
分类:
其他好文 时间:
2020-06-21 15:33:53
阅读次数:
111
当A不是矩阵时: sum(A)表示对A中的数进行求和 当A是m*n矩阵时: sum(A,1)和sum(A)都表示对矩阵中的每一列进行求和,并返回1行n列的矩阵 sum(A,2)表示对矩阵中的每一行进行求和,并返回m行1列的矩阵 例: A1 = [1, 3, 2; 1, 3, 2] S = sum(A ...
分类:
其他好文 时间:
2020-06-21 14:14:16
阅读次数:
67
#include<map> #include<queue> #include<time.h> #include<limits.h> #include<cmath> #include<ostream> #include<iterator> #include<set> #include<stack> # ...
分类:
移动开发 时间:
2020-06-21 14:06:53
阅读次数:
54