Question: Lucy loves to play the Hop, Skip, and Jump game. Given an N*M matrix and starting from cell (1,1), her challenge is to hop in an anti-clockwise direction and skip alternate cells. The goal is to find out the last cell she would hop onto.
Write an algorithm to find the last cell Lucy would hop onto after moving anti-clockwise and skipping alternate cells.
Input:
matrix_row and matrix_col, representing the number of rows (N) and the number of columns (M) in the matrix, respectively.Output:
Example Input:
3 3 29 8 37 15 4 1 3 10 14
Output:
41
Explanation: Lucy starts with 29, skips 15, hops onto 1, skips 10, hops onto 14, skips 3, hops onto 37, skips 8, and finally hops onto 41. So, the output is 41.
Question: Lucy loves to play the Hop, Skip, and Jump game. Given an N*M matrix and starting from cell (1,1), her challenge is to hop in an anti-clockwise direction and skip alternate cells. The goal is to find out the last cell she would hop onto. Write an algorithm to find the last cell Lucy would hop onto after moving anti-clockwise and skipping alternate cells.
Input:
The first line of input consists of two integers, matrix_row and matrix_col, representing the number of rows (N) and the number of columns (M) in the matrix, respectively. The next M lines consist of N space-separated integers representing the elements in each cell of the matrix.
Output:
Print an integer representing the last cell Lucy would hop onto after following the given instructions.
Example Input:
3 3 29 8 3 7 15 4 1 10 14
Output:
41
Explanation:
Lucy starts with 29, skips 15, hops onto 1. She skips 10, hops onto 14, skips 3, hops onto 37, skips 8, and finally hops onto 41. So, the output is 41.
The following metrics were computed from 436 interview experiences for the Cisco Software Engineer role in United States.
Cisco's interview process for their Software Engineer roles in the United States is fairly selective, failing a large portion of engineers who go through it.
Candidates reported having very good feelings for Cisco's Software Engineer interview process in United States.