9. decode message
Share
medium - accepted / - tried
Your are given a 2-D array of characters. There is a hidden message in it.
I B C A L K AD R F C A E AG H O E L A D
The way to collect the message is as follows
- start at top left
- move diagonally down right
- when cannot move any more, try to switch to diagonally up right
- when cannot move any more, try switch to diagonally down right, repeat 3
- stop when cannot neither move down right or up right. the character on the path is the message
for the input above, IROCLED
should be returned.
notes
if no characters could be collected, return empty string