codevn

codevn

V2EX member #89262, joined on 2014-12-31 10:20:35 +08:00
Per codevn's settings, the topics list is hidden
Deals info, including closed deals, is not hidden
codevn's recent replies
21 days ago
Replied to a topic by hardto 推广 免费发 codex 10000 刀
Apr 27, 2024
Replied to a topic by cochlea 编程 二叉树剪切的一个题目,不知掉如何解
```
class TreeNode {
constructor(value = 0, children = []) {
this.value = value;
this.children = children;
}
}

function trimTree(root, target) {
if (!root) return null;

let queue = [root];
let result = new TreeNode(root.value);
let resultQueue = [result];
let currentSum = root.value;

while (queue.length > 0) {
let currentNode = queue.shift();
let resultNode = resultQueue.shift();

let childrenSum = 0;
let tempChildren = [];

for (let child of currentNode.children) {
queue.push(child);
childrenSum += child.value;
let newChild = new TreeNode(child.value);
tempChildren.push(newChild);
resultQueue.push(newChild);
}

if (currentSum + childrenSum <= target) {
resultNode.children = tempChildren;
currentSum += childrenSum;
} else {
let remaining = target - currentSum;
resultNode.children = [];
for (let child of tempChildren) {
if (child.value <= remaining) {
resultNode.children.push(child);
remaining -= child.value;
} else {
child.value = remaining;
resultNode.children.push(child);
break;
}
}
break;
}
}

return result;
}

// 示例
let child1 = new TreeNode(80);
let child2 = new TreeNode(80);
let root = new TreeNode(100, [child1, child2]);

let trimmedTree = trimTree(root, 200);
console.log(trimmedTree);

```
这意思么?
人家是规则制定者? 你准备制裁他? 法律不管这个事的~
你可以学着适应,或者适应,也可以适应~
但凡你有能力改变这件事,应该也没这个帖子了吧
Sep 14, 2022
Replied to a topic by gladinum 职场话题 苟在大厂 or 创业公司
涨幅 20% => 别跑
涨幅 20K => 马上跑
半斤的不要说八两了。
一向不都是 p6~p8 么,这次降级到 p5 了?
其实也不能怪大厂卡学历;
学历这东西是一个可查询并且公允的成果; 也算是一个别人可见的 "最高成就";
大厂往往是想通过你的"最高成就"来评定以及预估你的的水平以及未来的成就;
你可以尝试其他方式取得"最高成就", 比如在某些技术社区产生影响力 / git 拿到几 k 的 star/某些技术峰会发表过演讲等等~
否则真的很难拿到大厂的 offer;
亲身体会告诉你: 辍学的那一天到你现在的时间足够取得一定成就了,如果还没有取得一定成就,你可能真的要反思一下自己问题在哪里了.
补充一点,你如果有 >=p8 的水准那么请无视学历这件事~
大厂基本都卡学历,阿里相对好一些; 举个例子
如果你学历不行,你需要绕过 HR 去找招人部门内推,然后你的水平至少是你面的级别+1,比如你要拿 p6 岗位,你至少要有 P6+甚至 P7 水准,这个时候你才大概率能拿到 offer ;
然后在内部好好奋斗,基本一年左右就能升职到真正符合自身水准的级别了;
About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   4874 Online   Highest 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 12ms · UTC 04:03 · PVG 12:03 · LAX 21:03 · JFK 00:03
♥ Do have faith in what you're doing.