100DaysOfCode Day 75: LeetCode 'Even Odd Tree' Solution with BFS

Day 75 of #100DaysOfCode Today I solved "Even Odd Tree" on LeetCode using Level Order Traversal (BFS). Key Idea: Each level of the tree must follow specific rules: Even-indexed levels (0, 2, 4...) • All values must be odd • Values must be in strictly increasing order Odd-indexed levels (1, 3, 5...) • All values must be even • Values must be in strictly decreasing order Approach: • Traverse the tree level by level using a queue (BFS) • Track the previous value for comparison • Validate both parity (odd/even) and ordering constraints Concepts Used: • Binary Trees • Breadth-First Search (BFS) • Level Order Traversal • Conditional validation Time Complexity: O(n) Space Complexity: O(n) This problem was a great mix of tree traversal + logical constraints, making it both tricky and fun Consistency is turning effort into skill. #Day75 #100DaysOfCode #LeetCode #BinaryTree #BFS #Cpp #CodingJourney

  • graphical user interface, application

To view or add a comment, sign in

Explore content categories