问一道L烂大街的题 题意还是有点不懂 顺便报FG面经# JobHunting - 待字闺中
c*h
1 楼
问一道L家烂大街的题 nestedint reversed weighted sum
Compute the reverse depth sum of a nested list meaning the reverse depth of
each node (ie, 1 for leafs, 2 for parents of leafs, 3 for parents of parents
of leafs, etc.) times the value of that node.
这个例子应该怎么算?
{{1,2}, 1, {2, {2,1}}} = ?
{1,2}的weight应该是1 还是2?按照定义它应该是leaf吧 所以应该是
(1+2)*1 + 1 * 3 + (2*2 + (2+1) * 1) = 13?
对说好的FG面经
F考了个BST里面找successor 就一题 各种变 有parent 没parent 用stack不用stack
G家考了俩 第一个是给了两个有重复元素的list 求差集 第二题是LC min stack变种
维护最小次小元素
Compute the reverse depth sum of a nested list meaning the reverse depth of
each node (ie, 1 for leafs, 2 for parents of leafs, 3 for parents of parents
of leafs, etc.) times the value of that node.
这个例子应该怎么算?
{{1,2}, 1, {2, {2,1}}} = ?
{1,2}的weight应该是1 还是2?按照定义它应该是leaf吧 所以应该是
(1+2)*1 + 1 * 3 + (2*2 + (2+1) * 1) = 13?
对说好的FG面经
F考了个BST里面找successor 就一题 各种变 有parent 没parent 用stack不用stack
G家考了俩 第一个是给了两个有重复元素的list 求差集 第二题是LC min stack变种
维护最小次小元素