Given a list of words and two words word1 and word2, return the shortest distance between these two words in the list. Example:Assume that words = ["p ...
分类:
其他好文 时间:
2019-11-18 09:28:36
阅读次数:
56
389. Find the Difference Easy Easy Easy Given two strings s and t which consist of only lowercase letters. String t is generated by random shuffling s ...
分类:
其他好文 时间:
2019-11-18 09:22:52
阅读次数:
65
Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element. Example ...
分类:
其他好文 时间:
2019-11-18 09:20:14
阅读次数:
59
题目大意 给定n个不同的整数,求将它们分成两个集合X,Y,并且X集合中任意两个数的差 =A,Y集合中任意两个数的差 =B的方案数。 样例输入 5 3 7 1 3 6 9 12 样例输出 5 解析 不妨设$A B$,那么考虑如何动态规划。设$f[i]$表示第一个集合最后选择的数是i时的方案数。只用枚举 ...
分类:
其他好文 时间:
2019-11-18 00:03:49
阅读次数:
61
题意:n(10^5)个问题,每个问题能被[li,ri]的人解决,要把n个问题分到两次测试中,使AK的人最多,测试至少包含一个问题。 找到最小的r(rmin)和最大的l(lmax),然后考虑两种情况, 1:rmin和lmax在一场测试中,显然此时答案为max(rmin-lmax,0)+除端点包含这两个 ...
分类:
其他好文 时间:
2019-11-17 23:59:14
阅读次数:
137
Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have ex ...
分类:
其他好文 时间:
2019-11-17 13:09:53
阅读次数:
72
max/min()/filter()/map/sorted()/reduce() ...
分类:
编程语言 时间:
2019-11-17 12:54:01
阅读次数:
75
Given an array where elements are sorted in ascending order, convert it to a height balanced BST. For this problem, a height-balanced binary tree is d ...
分类:
其他好文 时间:
2019-11-16 21:49:38
阅读次数:
70
A.Two Rival Students 小的位置向左走,大的位置向右走直到走到最左或最右端或者x为0。 include using namespace std; mapmp; int main() { int t; scanf("%d",&t); while(t ) { mp.clear(); i ...
分类:
其他好文 时间:
2019-11-16 19:16:27
阅读次数:
106
冠冕堂皇的引言 之前已经画了一个憨憨的三角形。如果是画由两个三角形组成的四边形的话...... 此时就会出现一个问题,我们指定 右下角 和 左上角 两次,就显得有一丝的多余。所以我们引入了 索引缓冲对象( Element Buffer Object , EBO )( 也叫IBO,Index Buff ...
分类:
其他好文 时间:
2019-11-16 17:59:44
阅读次数:
78