This problem requires us to point the next of the left node in each layer to the right node. Because it is processed layer by layer, it is very intuitive to think of using BFS to solve it.
This problem requires us to point the next of the left node in each layer to the right node. Because it is processed layer by layer, it is very intuitive to think of using BFS to solve it.
After reading the problem at the beginning, you can probably feel that DFS should be used to solve it. Use DFS to calculate the sum of each inform time from headID to a leaf, and finally take the maximum time.
Union Find data structure is also known as disjoint set data structure. It is a data structure which stores a collection of disjoint sets. It provides two operations, one for merging two sets and one for finding the set with a given element.
Looper and Handler are one of the Android core components, and many high-level components are built on top of them. Understanding them helps us understand how some core components work. This article will introduce Looper and Handler and related components.