Company: Flipkart DE IIT BHU
Difficulty: medium
Island Safe Zone Navigation Problem Description You are given an MxN grid. Cells in the grid can be one of two types: Islands: There are n islands, denoted by numbers 1 through n . Water: Denoted by 0 . A few cells (which can be either islands or water) are selected and called safe cells. These set of cells collectively form the Safe Zone . You are initially deployed at a particular island cell. Your objective is to reach an island cell that is part of the Safe Zone. You can only travel through water. This implies that movement from an island must be to an adjacent water cell, and movement from a water cell can be to an adjacent water cell or to an adjacent island cell (if it is the target Safe Zone island). Initially, you have Z health. Each time you move to a cell with value i (where i is 0 for water, or 1 to n for an island), your health decreases by i . You need to print the maximum remaining health with which you could reach an island in the Safe Zone. If you lose 100% of your hea