Skip to content

Refactor find leaves solution#73

Merged
eselyavka merged 1 commit into
masterfrom
refactor/find-leaves-dfs-height
May 9, 2026
Merged

Refactor find leaves solution#73
eselyavka merged 1 commit into
masterfrom
refactor/find-leaves-dfs-height

Conversation

@eselyavka
Copy link
Copy Markdown
Owner

Summary

  • replace repeated leaf removal with a single DFS grouped by node height
  • stop mutating the input tree during leaf collection
  • keep the existing test passing with a simpler O(n) traversal approach

Testing

  • python3 -m unittest practice.leetcode.solutions_00300.solution_00366
  • pytest
  • pylint on changed files

@eselyavka eselyavka merged commit 3676684 into master May 9, 2026
4 checks passed
@eselyavka eselyavka deleted the refactor/find-leaves-dfs-height branch May 9, 2026 18:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant