1609. Even Odd Tree

Binary trees serve as a fundamental data structure in computer science, offering versatile solutions to various problems. One such intriguing problem is determining whether a given binary tree is an Even-Odd Tree. In this blog post, we’ll embark on a journey to understand the concept of an Even-Odd Tree and delve into an algorithmic solution…


2385. Amount of Time for Binary Tree to Be Infected

Problem Statement: https://leetcode.com/problems/amount-of-time-for-binary-tree-to-be-infected/description/ Decoding the Algorithm: 1. Initialization and Connection Mapping: A HashMap (parentChildMap) is used to establish connections between child and parent nodes, essential for navigating the tree. The startNode is identified by traversing the tree until the desired node with the given value (start) is found. 2. Breadth-First Search (BFS): A LinkedList (queue)…

BFS daigram

Open the Lock

Problem Statement To be frank, as I read the problem I realized it is a BFS problem. Let’s see what was my thought, we have to count the number of steps to reach the final string, this denotes we have to traverse the intermediate nodes. We cannot directly jump to the final string and apply…