Loading problem…
You are given a 2D array of characters. A hidden message is formed by walking a zigzag diagonal path.
Implement decodeMessage(grid).
decodeMessage(grid)
(0, 0)
(r + 1, c + 1)
(r - 1, c + 1)
Return the collected characters as a string.
const grid = [ ['A','x','x','x','E','x','x'], ['x','B','x','D','x','F','x'], ['x','x','C','x','x','x','G'], ] decodeMessage(grid) // "ABCDEFG"
3 hints available with Pro
No related problems available yet.