This is a verified interview question from Flipkart-grid. Candidates reporting seeing this problem in recent Online Assessments (OAs) and onsite rounds. Mastering "Robot Bounded In Grid - Flipkart Grid 7.0" covers key patterns like DP.
"You are given a board of size M x N where each cell can be either empty(0) or a wall(X). A robot is initially placed at the cell on the top left corner and has to visit all the empty cells on the board that it can reach by either walking straight or backward or by taking 90 turns, i.e. it cannot move diagonally. Print the maximum number of cells the robot can visit. Read the input from STDIN and print the output to STDOUT. Do not write arbitrary strings anywhere in the program, as these contribute to the standard output and testcases will fail."
Join thousands of developers practicing for Flipkart-grid.