Google L4 BLR 1st round - Rejection
Anonymous User
757
Aug 11, 2026
Aug 11, 2026
This was the question:
You are given a 2D matrix of integers and you're asked to find
the maximum path length from any given cell in the matrix such
that some conditions are specified.
If you're moving from cell A to cell B, then height of
cell B <= height of cell A.
If the sequence is more like cell X -> cell A -> cell B -> cell C,
then height of cell C <= height of cell B or we do a jump up till
the height of cell A, as in, the path can be such that either
(height of cell C <= height of cell B) or
(height of cell C > height of cell B and
height of cell C <= height of cell A).
You cannot revisit a cell during your traversal.
And the jump up operations can be used any number of times
during the traversal, just that, make sure that for the 1st 2
elements of the sequence, the height of
element 1 >= height of element 2.I tried giving an approach based on treating each of the cells present in the 2D grid as a starting point and then for each starting point, I did BFS wherein, each element of my queue had the structure:
{currentCellHeight, prevCellHeight, prevToPrevCellHeight, rowNum, columnNum}Please do give links to similar problems if you've encountered before in LC, feeling quite demotivated.
Comments (3)


