Cisco OA New Grad 2024
Anonymous User
723

Can someone answer this question in C++14? I'm struggling to solve this correctly.

Lucy loves to play the Hop, Skip, and Jump game. Given 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 that prints an integer representing the last cell Lucy would hop onto after moving anti-clockwise and skipping alternate cells.

use this function definition:
void funcHopSkipJump(vector<vector> matrix)

Just print the last integer of the cell that Lucy would be on

For example
Input: 29 8 37
15 41 3
1 10 14

Output is: 41

image
image

Comments (3)