当前位置:网站首页>Niuke-top101-bm340
Niuke-top101-bm340
2022-07-28 03:00:00 【A fish that eats cats】
import java.util.*;
/** * Definition for binary tree * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */
public class Solution {
public TreeNode reConstructBinaryTree(int [] pre,int [] vin) {
int n = pre.length;
int m = vin.length;
if(n == 0 || m == 0){
return null;
}
TreeNode t = new TreeNode(pre[0]);
for(int i = 0; i < vin.length; i++){
if(pre[0] == vin[i]){
t.left = reConstructBinaryTree(Arrays.copyOfRange(pre, 1, i+1), Arrays.copyOfRange(vin, 0, i));
t.right = reConstructBinaryTree(Arrays.copyOfRange(pre, i+1, pre.length), Arrays.copyOfRange(vin, i+1, vin.length));
break;
}
}
return t;
}
}
边栏推荐
- Oracle basicfile lob field space recycling shrink space doubts
- 阿憨的故事
- IO flow: node flow and processing flow are summarized in detail.
- 特征值和特征向量
- tfx airflow 使用体验
- Newline required at end of file but not found.
- JS 事件对象2 e.charcode字符码 e.keyCode键码 盒子上下左右移动
- [elm classification] classification of UCI data sets based on nuclear limit learning machine and limit learning machine, with matlab code
- 树的孩子兄弟表示法
- 初识C语言 -- 操作符和关键字,#define,指针
猜你喜欢

别人发你的jar包你如何使用(如何使用别人发您的jar包)

PS simple to use

Newline required at end of file but not found.

POC simulation attack weapon - Introduction to nucleus (I)
![[image defogging] image defogging based on dark channel and non-mean filtering with matlab code](/img/39/6266eb14deac9f38b7e95f7291067e.png)
[image defogging] image defogging based on dark channel and non-mean filtering with matlab code

JS中的reduce()函数介绍

selenium+pytest+allure综合练习

数据湖:海量日志采集引擎Flume

Pycharm 快速给整页全部相同名称修改的快捷键

初识C语言 -- 操作符和关键字,#define,指针
随机推荐
[wechat applet development (VI)] draw the circular progress bar of the music player
[ACNOI2022]总差一步
修改MySQL密码的四种方法(适合初学者)
JS event object offsetx/y clientx y pagex y
First knowledge of C language -- structure, branch and loop statements
树的孩子兄弟表示法
trivy【1】工具扫描运用
一次跨域问题的记录
TypeScript(零) —— 简介、环境搭建、第一个实例
Job 7.27 IO process
【信号处理】基于高阶统计量特征的通信系统中微弱信号检测附matlab代码
【英雄哥七月集训】第 27天:图
Commissioning experience of ROS
[self growth website collection]
CNN training cycle reconstruction - hyperparametric test | pytorch series (XXVIII)
Retainface use error: modulenotfounderror: no module named'rcnn.cyton.bbox'
“29岁,普通功能测试,我是如何在一周内拿到5份Offer的?”
tfx airflow 使用体验
Canvas from getting started to persuading friends to give up (graphic version)
What "posture" does JD cloud have to promote industrial digitalization to climb to a "new level"?