jane
BAN USER
Questions (3)
Comments (5)
Reputation 10
- 0of 0 votes
AnswersThe shortest code by character count that takes a single input integer N (N >= 3) and returns an array of indices that when iterated would traverse an NxN matrix according to the JPEG "zigzag" scan pattern.
For Ex
- jane in United States1 2 3 (Input) 3 --> 4 5 6 --> 7 8 9 Output--> 1 2 4 7 5 3 6 8 9 1 2 3 4 (Input) 4 --> 5 6 7 8 9 10 11 12 13 14 15 16 output 1 2 5 9 6 3 4 7 10 13 14 11 8 12 15 16
| Report Duplicate | Flag | PURGE
Amazon Developer Program Engineer Algorithm
CareerCup is the world's biggest and best source for software engineering interview preparation. See all our resources.
how you figured out that loop needs to be executed for 2*n-1 times??
- jane August 15, 2012Can you pls explain the algo?