You are given an undirected graph without self-loops or multiple edges which consists of nn vertices and mm edges. Also you are given three integers n ...
分类:
其他好文 时间:
2020-05-19 00:53:03
阅读次数:
67
Description Given an integer array , find the contiguous subarray (containing at least one number) which has the largest sum and return its sum. Examp ...
分类:
其他好文 时间:
2020-05-18 22:47:34
阅读次数:
65
题目 Given a sequence of K integers { N?1?? , N?2?? , ..., N?K?? }. A continuous subsequence is defined to be { Ni?? , N?i+1?? , ..., N?j?? } where 1≤i≤ ...
分类:
其他好文 时间:
2020-05-18 22:37:14
阅读次数:
57
给定一个数组和一个目标数字,求数组中的4个元素之和等于目标数字,输出这4个数字所有可能的组合。 Given array nums = [1, 0, -1, 0, -2, 2], and target = 0. A solution set is:[ [-1, 0, 0, 1], [-2, -1, 1 ...
分类:
其他好文 时间:
2020-05-18 21:02:32
阅读次数:
41
"传送门" 题意: 求以每个点为根节点的树的拓扑序计数。 思路: 是一个挺经典的问题。 我们考虑自下而上的树形$dp$:假设我们当前点在$u$,我们已经求出来了$dp[v],v\in sons_u$。 现在要求$u$的方案数,我们考虑在$u$放上$1$,然后剩下$sz[u] 1$个数生成一个排列依次 ...
分类:
其他好文 时间:
2020-05-18 18:41:24
阅读次数:
60
Given any string of N (≥) characters, you are asked to form the characters into the shape of U. For example, helloworld can be printed as: h d e l l r ...
分类:
其他好文 时间:
2020-05-17 01:18:46
阅读次数:
53
Given a sequence with n elements, if the last element is also adjacent to the first element of the sequence, the sequence is called “circular sequence ...
分类:
其他好文 时间:
2020-05-16 10:45:50
阅读次数:
69
Given a sorted (in ascending order) integer array nums of n elements and a target value, write a function to search target in nums. If target exists, ...
分类:
其他好文 时间:
2020-05-15 09:23:28
阅读次数:
56
Description: Given a non-negative integer num represented as a string, remove k digits from the number so that the new number is the smallest possible ...
分类:
其他好文 时间:
2020-05-15 00:34:42
阅读次数:
86
Description: You are given a sorted array consisting of only integers where every element appears exactly twice, except for one element which appears ...
分类:
其他好文 时间:
2020-05-15 00:27:32
阅读次数:
77