LC 100

Same Tree

Easy · LC 1–100 + first-family candidate

binary-treebreadth-first-searchdepth-first-searchtree
Free

Candidate solution routes

Primary

Tree level-order BFS

Free

Invariant: At each round start, the queue contains every node of the current depth and no other depth. After exactly level_size pops, it contains exactly the next depth.

candidate confidence: 0.523 · metadata_only

Alternate 1

Tree recursive aggregation

Free

Invariant: dfs(u) returns a summary concerning only u's subtree and satisfying its parent contract; before return, every global candidate fully contained in that subtree has been considered.

candidate confidence: 0.603 · metadata_only

Alternate 2

DFS Components and Reachability

Free

Invariant: Once marked visited, a vertex belongs to the component represented by the current search and can never join a later component.

candidate confidence: 0.610 · metadata_only

Alternate 3

BFS Connectivity Traversal

Free

Invariant: Every queued vertex is discovered and assigned to the current component but not fully expanded; an unseen vertex is not yet proven reachable from this start.

candidate confidence: 0.464 · metadata_only

How to use this page

Read the statement and constraints first, then validate recognition signals, invariant, and complexity. Candidate score is not correctness evidence.