当前位置:网站首页>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;
边栏推荐
- Detailed explanation of DHCP distribution address of routing / layer 3 switch [Huawei ENSP]
- Sequences, time series and prediction in tessorflow quizs on coursera (I)
- 拦截器和过滤器
- Calendar common methods
- Math
- 2020-2021 new technology lecture course
- Typora user manual
- Common problems of multithreading and concurrent programming (to be continued)
- Nezha monitoring - server status monitoring, SSL certificate change expiration, Ping monitoring and scheduled task reminder
- 2022 Summer Games of Hangzhou electric power multiple schools 1012aalice and Bob (game theory)
猜你喜欢

卷积神经网络感受野计算指南

暑期牛客多校1: I Chiitoitsu(期望dp,求逆元)

LTSpice software power settings
![[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

Literature reading: gopose 3D human pose estimation using WiFi

What are the benefits of knowledge management in enterprises?
![[resolved] CVC datatype valid. 1.2.1: '' is not a valid value for 'ncname'.](/img/27/ae15e553eba99acf19beb93a3e9939.jpg)
[resolved] CVC datatype valid. 1.2.1: '' is not a valid value for 'ncname'.

轻松学Pytorch-迁移学习实现表面缺陷检查

Crazy God redis notes 11
![[JVM learning 03] class loading and bytecode Technology](/img/b4/9482b02b58580171235fd4c36129e9.png)
[JVM learning 03] class loading and bytecode Technology
随机推荐
Principle and application of database
Tclsh array operation
为什么梯度是函数变化最快的方向
知乎上的那些神回复
OpenGL learning (V) modern OpenGL triangle rendering
C Programming classic tutorial
Oneinstack installation and configuration PHP 8.1 and MySQL 8.0-oneinstack site building novice tutorial
The difference between static method and instance method
MySQL hidden version number
2022暑期杭电多校第一场1012Alice and Bob(博弈论)
Tcl/tk grouping and replacement rules
Biopharmaceutical safety, power supply and production guarantee
Cesium uses czml to implement dynamic routes
[question 39] special question for Niuke in-depth learning
Summary of articles in 2020
32-bit stack overflow advanced
Analysis of dropout principle in deep learning
asp. Net coree file upload and download example
core dump
PCI express physical layer - electrical part