当前位置:网站首页>Leetcode652 finding duplicate subtrees
Leetcode652 finding duplicate subtrees
2022-07-24 19:15:00 【Coding~Man】
Title Description : Given a binary tree root, Return all duplicate subtrees . For the same kind of repeated subtrees , You just need to return the root node of any tree . If two trees have the same structure and the same node value , Then they are repeated .
analysis : To find duplicate subtrees , We can first get the subtree of each node , Then compare and judge these subtrees , If repeated, add it to the linked list . How to judge the structure of two subtrees is equal , Can be introduced map Judge , First, store the value of a subtree in map in , Then store each subtree separately map in , If you find that you have deposited before , Then put this node into the linked list , This constant cycle .
Knowledge point :hashmap Related knowledge
Map<String,Integer> count = new HashMap();
count.put(serial,count.getOrDefault(serial,0)+1);
count.get(serial) == 2;
Linked list knowledge points
List<TreeNode> ans;
边栏推荐
- Channel state information (CSI) conjugate multiplication denoising method
- Zooinspector Download
- Nacos introduction and console service installation
- 【无标题】
- Zooinspector Download
- 2022 Hangdian multi school second session 1009 shuangq (Mathematics)
- 第4章 复合类型
- 2022杭电多校第一场Dragon slayer(dfs+状态压缩)
- BUUCTF-pwn[1]
- Ebpf verifier
猜你喜欢

OpenGL learning (III) glut two-dimensional image rendering

OPENGL学习(三)GLUT二维图像绘制

暑期牛客多校1: I Chiitoitsu(期望dp,求逆元)
![[laser principle and application -6]:q switching element and Q drive circuit board](/img/30/e199b73fb9b0ad335f26f2378cfc45.png)
[laser principle and application -6]:q switching element and Q drive circuit board

2022杭电多校第二场1009 ShuanQ(数学)

PWN learning
思源笔记 v2.1.2 同步问题

This visual analysis library makes it easy for you to play with data science!

Sequences, time series and prediction in tessorflow quizs on coursera (I)

32-bit stack overflow advanced
随机推荐
Free and open source website navigation source code collection, sorting and summary - self built personal navigation Homepage
Nacos introduction and console service installation
暑期牛客多校1: I Chiitoitsu(期望dp,求逆元)
Zooinspector Download
Taokeeper environment setup
PCIe link initialization & Training
Pam4 popular science
Sqoop
New stage of investment
PostgreSQL weekly news - July 13, 2022
Onemanager and cloudflare workers deployment and installation - binding domain names and using cloudflare CDN acceleration
为什么梯度是函数变化最快的方向
Taokeeper environment setup
MySQL hidden version number
Summary of articles in 2020
C Programming classic tutorial
[understanding of opportunity-48]: Guiguzi - Chapter 7 - collect information in advance, make predictions and implementation plans in advance
Get module handle / base address
Timed task framework
Serial vector format (SVF) file format