0626微软he

1 印度人说array size不能变
3中国人抬一手,其实我不会
4 lc原题19,我瞎查了个gfg就回答了,结果太复杂了,自己写的,就不完美吧。两个指针先后n我都忘了(捂脸)
-其实题目很简单,没必要复习很复杂的东西。可是我是真的手生了。算了我还是回去工作吧。有经历以后,bq真的自然多了。
工作请假,提心吊胆,担心受怕,还是算了吧。我胆小,我怂批。起码不要和开会时间撞车吧。。

我旷工面试就勤奋了吗?就高尚了吗?
认清自己的水平不行也挺好的:死记硬背的东西不是自己的,一段时间不碰就手生。

不能死记硬背所以呢 起码挂的题记住。也未必还需大量面试的磨练,哪怕不面试,就重复做几遍也好。要多练习才会理解。
所以要保持勤劳,想面的公司就面一面。消磨时间也挺好的。贱逼苦码农,死书呆子🤓️,一辈子学习的命!
priority:找对象先,再面试。

 

using System;

namespace Solution
{
public class TreeNode {
public int val;
public TreeNode left;
public TreeNode right;
public TreeNode(int x) { val = x; }
}

public class Solution {
public const int Threshold = 6;
public static TreeNode PruneTree(TreeNode root) {
if (root == null) {
return root;
}

root.left = PruneTree(root.left);
root.right = PruneTree(root.right);

// both children have been handled.
// determine whether this node needs to be cut or not.
// cut or return the node;
//1.both null 2.one null 3.both not null
if (root.left == null && root.right == null) {
//compare root with Threshold
if (root.val < Threshold) return null;
else return root;
}else if (root.left == null && root.right != null) {
return root;
}else if (root.left != null && root.right == null){
return root;
}else {
return root;
}
}

public static void PrintTree(TreeNode t, int parentValue) {
if (t == null) {
Console.WriteLine($"N from {parentValue}");
return;
}
Console.WriteLine(t.val);
PrintTree(t.left, t.val);
PrintTree(t.right, t.val);
}
public static void Main(string[] args) {
var root = new TreeNode(7);
root.left = new TreeNode(2);
root.left.left = new TreeNode(5);
root.left.right = new TreeNode(4);
root.right = new TreeNode(9);
root.right.left = new TreeNode(3);
root.right.right = new TreeNode(1);
root.right.left.left = new TreeNode(10);
PrintTree(root, int.MinValue);
Console.WriteLine("*******");
root = PruneTree(root);
PrintTree(root, int.MinValue);
}

//compare
public void recursion(TreeNode node) {
//end
if (node.val < Threshold)
//cut function


//compare
recursion(node.left);
recursion(node.right);
}

//cut

 


}
}

 

 
posted @ 2022-06-29 13:46  苗妙苗  阅读(108)  评论(0编辑  收藏  举报