class Solution { public int[] twoSum(int[] nums, int target) { int[] result = new int[2]; for(int i = 0;i<nums.length;i++){ for(int j= i+1; j<nums.len ...
分类:
其他好文 时间:
2020-04-06 17:14:23
阅读次数:
76
最小路径和 LeetCode: "最小路径和" 题目描述: 给定一个包含非负整数的 m x n 网格,请找出一条从左上角到右下角的路径,使得路径上的数字总和为最小。 说明:每次只能向下或者向右移动一步。 示例: 思想: 动态规划,可以用原数组作为dp数组 代码: 三角形最小路径和 LeetCode: ...
分类:
编程语言 时间:
2020-04-06 14:06:18
阅读次数:
96
不使用递归import os from os.path import join, getsize def getdirsize(dir): size = 0 for root, dirs, files in os.walk(dir): size += sum([getsize(join(root, ...
分类:
其他好文 时间:
2020-04-06 13:48:49
阅读次数:
64
题意:https://codeforces.com/contest/1219/problem/A 每次占一个点,获取一个价值(与该点连通的未占数量),每次选的点必须与占的点相连。 问你最大获益 思路: 树dp出以某个树开始往环上走。 然后就开始考虑环我们怎么走,首先我想的是枚举以那颗树为起点,每次走 ...
分类:
其他好文 时间:
2020-04-06 13:39:32
阅读次数:
80
题面 The SUM problem can be formulated as follows: given four lists A, B, C, D of integer values, compute how many quadruplet (a, b, c, d ) ∈ A x B x C ...
分类:
编程语言 时间:
2020-04-06 13:38:34
阅读次数:
66
Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum. Example: Inpu ...
分类:
其他好文 时间:
2020-04-06 11:37:02
阅读次数:
81
Given the node of a binary search tree, return the sum of values of all nodes with value between and (inclusive). The binary search tree is guaranteed ...
分类:
其他好文 时间:
2020-04-06 09:50:46
阅读次数:
73
1. 求工资 大于 8888 , 年龄大于32 的人数 SELECT SUM(CASE WHEN SALARY > 8888 AND AGE >32 THEN 1 ELSE 0 END) FROM S_EMP; 2.如何快速求得各班最高得分 SELECT(CLASS_NO,MAX(SCORE)) G ...
分类:
其他好文 时间:
2020-04-06 09:23:25
阅读次数:
63
Julia语言具有强大的元编程机制,本文用Julia实现《SICP》中文第二版中第 99 页中的实例:符号求导,体验一下Julia元编程。 运行结果如下: julia> include("deriv.jl") # 加载代码multiplicand (generic function with 1 m ...
分类:
其他好文 时间:
2020-04-05 22:35:14
阅读次数:
142
求$\sum{\left \lfloor \frac{n}{i} \right \rfloor}$ 慢且麻烦的一般方法: 设 $s=\left \lfloor \sqrt{n} \right \rfloor$ 对于ss的分块算 常数很大 考虑$\sum{\left \lfloor \frac{n}{ ...
分类:
其他好文 时间:
2020-04-05 22:32:21
阅读次数:
116