[PR #1483] [CLOSED] feat: add LeetCode problem 100 #2083

Closed
opened 2026-01-29 15:28:29 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/TheAlgorithms/C/pull/1483
Author: @richvigorito
Created: 9/14/2025
Status: Closed

Base: masterHead: solution/leetcode-100


📝 Commits (1)

  • 4b4df32 feat: add LeetCode problem 100

📊 Changes

1 file changed (+17 additions, -0 deletions)

View changed files

leetcode/src/100.c (+17 -0)

📄 Description

Check for tree equivalence

Description of Change

We recursively traverse both trees simultaneously:

If both nodes are NULL, return true.
If only one of them is NULL, return false.
Compare the current node values. If they differ, return false.
Recursively check the left children and right children. Both must be true for the trees to be the same.

This naturally follows the definition of two identical trees.

References

Checklist

  • Added description of change
  • Added file name matches
  • Added tests and example, test must pass. CLICK HERE to run in leetcode
  • Relevant documentation/comments is changed or added
  • PR title follows semantic
  • Search previous suggestions before making a new one, as yours may be a duplicate.
  • I acknowledge that all my contributions will be made under the project's license.

Notes:


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/TheAlgorithms/C/pull/1483 **Author:** [@richvigorito](https://github.com/richvigorito) **Created:** 9/14/2025 **Status:** ❌ Closed **Base:** `master` ← **Head:** `solution/leetcode-100` --- ### 📝 Commits (1) - [`4b4df32`](https://github.com/TheAlgorithms/C/commit/4b4df325f388d37766da52184bef0f69e8b5ad53) feat: add LeetCode problem 100 ### 📊 Changes **1 file changed** (+17 additions, -0 deletions) <details> <summary>View changed files</summary> ➕ `leetcode/src/100.c` (+17 -0) </details> ### 📄 Description Check for tree equivalence #### Description of Change We recursively traverse both trees simultaneously: If both nodes are NULL, return true. If only one of them is NULL, return false. Compare the current node values. If they differ, return false. Recursively check the left children and right children. Both must be true for the trees to be the same. This naturally follows the definition of two identical trees. <!-- Thank you for your Pull Request. Please provide a description above and review the requirements below. Contributors guide: https://github.com/TheAlgorithms/C/blob/master/CONTRIBUTING.md --> #### References <!-- Add any reference to previous pull-request or issue --> #### Checklist <!-- Remove items that do not apply. For completed items, change [ ] to [x]. --> - [x] Added description of change - [x] Added file name matches - [x] Added tests and example, test must pass. [CLICK HERE to run in leetcode](https://leetcode.com/problems/same-tree/solutions/7187435/recursive-c-solution-by-richvigorito-khw2) - [x] Relevant documentation/comments is changed or added - [x] PR title follows semantic - [x] Search previous suggestions before making a new one, as yours may be a duplicate. - [x] I acknowledge that all my contributions will be made under the project's license. Notes: <!-- Please add a one-line description for developers or pull request viewers --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-29 15:28:30 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/C#2083