Skip to content

Conversation

@darshkantaria
Copy link

This PR adds a C++ solution for LeetCode Problem #337 - House Robber III

  • Approach: Dynamic Programming (Tree DP) using Post-order DFS

  • Each node computes two states:

    1. Rob this node → cannot rob its children
    2. Skip this node → free to rob or skip children
  • Time Complexity: O(n), where n = number of nodes

  • Space Complexity: O(h), where h = height of the tree

The code includes detailed inline comments and explanation of the approach,
making it easy to understand and reusable for similar tree DP problems.

Optional test case is included but commented out for safe submission.

@github-actions
Copy link
Contributor

This pull request has been automatically marked as abandoned because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale Author has not responded to the comments for over 2 weeks label Nov 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stale Author has not responded to the comments for over 2 weeks

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant