Final answer:
To find the last cell Lucy would hop onto after moving anti-clockwise and skipping alternate cells in a given N*M matrix, we can use a simple algorithm.
Step-by-step explanation:
To find the last cell Lucy would hop onto after moving anti-clockwise and skipping alternate cells in a given N*M matrix, we can use a simple algorithm.
- Initialize two variables, row and col, to 0.
- Start from cell (1,1) and move in the anti-clockwise direction.
- While row is less than N and col is less than M, perform the following steps:
- At cell (row, col), skip the current cell by incrementing col by 1.
- If col is less than M and row is less than N, hop onto the next cell by incrementing row by 1.
- If row is less than N and col is less than M, hop onto the next cell by incrementing col by 1.
The last cell Lucy would hop onto is the cell at (row, col) when the loop ends.