Company: InMobi Codies_20june
Difficulty: medium
1. Cut Off Trees for Golf Event (From the first image) Problem Statement: You are tasked with cutting down all the trees in a forest for a golf event. The forest is represented as an m×n matrix where: 0 represents an obstacle that you cannot walk through. 1 represents empty ground that you can walk through. Any value > 1 represents a tree of that specific height. You can walk through this cell and cut the tree down. Rules & Conditions: Starting Point: You always start your journey at position (0, 0). Order of Operation: You must cut the trees in strict order of their height—shortest tree first. Movement: To cut a tree, you must navigate to its cell. Each step allows you to move to an adjacent cell in four directions (up, down, left, or right). Post-Cut State: After cutting a tree, its cell becomes empty ground (1) and remains walkable. You are also allowed to walk through a cell containing a tree without cutting it if it is not its turn to be cut. Uniqueness: All tree heights ar