Solved #100. Same Tree problem in Java with recursive approach

Day 43 of #100DaysOfLeetCode 💻✅ Solved #100. Same Tree problem in Java. Approach: • Used recursion to compare both binary trees simultaneously • If both nodes are null, returned true • If one node is null and the other is not, returned false • Checked whether the values of both nodes are equal • Recursively compared the left subtrees and right subtrees Performance: ✓ Runtime: 0 ms (Beats 100% submissions) 🚀 ✓ Memory: 43.10 MB (Beats 30.15% submissions) Key Learning: ✓ Practiced recursive traversal of binary trees ✓ Learned how to compare two trees node by node ✓ Strengthened understanding of tree recursion logic Learning one problem every single day 🚀 #Java #LeetCode #DSA #BinaryTrees #ProblemSolving #CodingJourney #100DaysOfCode

  • graphical user interface, application

To view or add a comment, sign in

Explore content categories