g**********y 发帖数: 14569 | 1 写了个要用辅助数组转化min-heap到BST的,原理就是从最小数开始,依次找successor
填空,
public void heap2Bst(int[] a) {
int N = a.length;
Arrays.sort(a);
int[] b = new int[N];
int i = leftest(0, N);
int j = 0;
while (j < N) {
b[i] = a[j];
i = successor(i, N);
j++;
}
for (i=0; i
}
private int successor(int i, int N) {
int next = right(i, N);
if (next >= 0) return lefte... 阅读全帖 |
|
x********n 发帖数: 450 | 2 underneath the surface, the world already trun right
the leftest race on this planet, han chinese , definitely extint in this
trend. |
|
a*********a 发帖数: 3656 | 3 ABC is one of the leftest, most liberal stations. next probably only to (MS)
NBC. |
|
s*x 发帖数: 8041 | 4 Avatar
John Springer • 14 hours ago
Just read how Russia built second pipeline to China and no longer using
dollars , but petro yuans and rubles. We can no longer simply use threat of
sanctions and tariffs. We can negotiate but must treat our peers, even those
who see the world differently, as participants or we will fail.
6
•Reply•
Avatar
Orange Juice John Springer • an hour ago
Who will buy our debt if we upset China? Trump arranged for record deficits
and he's trying... 阅读全帖 |
|
l******x 发帖数: 1697 | 5 if they can bite the hand of chicago major, the leftest of the left, what do
you expect?
dealing |
|
h******2 发帖数: 13 | 6 有哪位大神能详细讲一下 二面中的两道题吗?
对于第二道题, 我能想到的是:
可以用一个map > m_Indexes;
对于每个char,value中记录了index列表。 然后对于T中的每个char,先找第一个char
的leftest位置(smallest index), then find the second char, and it’s index
must be greater than the first’s char ‘s smallest index(that’s upper_
bound), and we do it iteratively until we all found it or not.
第一道 cactus的不太清楚怎么做啊?
二面
1. given a cactus graph, determine the number of different spanning trees of
this graph.
2. Given a very large string T, |T| = 10 000 000 cha... 阅读全帖 |
|
b**l 发帖数: 33123 | 7 Exit at Manhattan Blvd, go straight, stay on the leftest lane, pass
a tunnel. When you get out, pass one light, TongQing is at the square
on your right. |
|
p*********o 发帖数: 892 | 8 He told me is 66, but there is no word mentioned in the ticket about the
speed, just said careless driving : likely to endanger person.
but there are no people in the leftest road, could I argue for it? |
|
O***n 发帖数: 13127 | 9 5 is better.
stay in the leftest lane. by passing pb, normally it is ok |
|
G***G 发帖数: 16778 | 10 how about the leftest one? |
|
G***G 发帖数: 16778 | 11 that is quite normal to me.
I often drive 80mph in the leftest lane.
No policemen caught me. No one behind me horned me. |
|
X****r 发帖数: 3557 | 12 你这个思路好!正如netghost所说,第二步可以改进。
每行的一维问题不用O(mn), 只要O(n)就可以,这样最后的总复杂度就是O(mn)。
思路是维持一个栈,每个元素是高度和位置。
从左到右扫描一遍,对每个新遇到的高度,
将栈处理到栈顶元素的高度不比当前高度高为止——这些矩阵已经无法扩展了。
然后如果当前高度比栈顶元素高的话将当前高度和某一适当位置压栈。
原数组后要加0 以使最后栈能自动清空。
用如下子程序,在for(y=0;y
int maxSize1D( const vector& v ) {
int best = 0 ;
vector vx(v), positions, heights;
vx.push_back( 0 );
for( int i = 0 ; i < vx.size() ; i ++ ) {
int leftest = i ;
while( heights.size() && heights[heights.size()-1] > vx[i] ) { |
|
m****i 发帖数: 159 | 13 ok, lets imagine there r n hard balls. each radius r/2, with the 2 exceptions
of the leftest and rightest balls with only half of the ball( the curve side
is towards inside ).
now it is easy to c that the number of placing these n balls is the
distribution of placing n points with no neighbor distance longer than r.
lets imagine that we get rid of the part of the line which is covered by these
n balls. now the length of the line is reduced to [1-(n-1)r]. the prob is
equivalent to placing n poi |
|