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.
ᡣ˶ᵔ ᵕ ᵔ˶𐭩 Credit to Charlotte 🧡
matrix = [[29, 8, 37], [15, 41, 3], [1, 10, 14]] return = 41
🍓- Collect CoinsSeen Jun 2025
- FizzBuzz ProblemSeen May 2025
- Find Largest Sum Contiguous SubarraySeen May 2025
- Find Largest Sum of Continuous SequenceSeen May 2025
- Find Palindrome Sub-stringSeen May 2025
- Flight Path Package DropSeen May 2025
- Count Numbers with Digit SumSeen Mar 2025
- Maximum Chocolates from Jars (L.C. 198 :)Seen Mar 2025
public int findLastCell(int[][] matrix) {
// write your code here
}