I created an iterative solution to 6.22 based on a bit different thinking. It also removes the need to check for odd dimension. Check it out here.
Iterative solution to 6.22 in 1.4.7
Hey Ray,
I think your solution is very similar to the alternative implementation listed in the book. Please take a look of that.
0 Likes
ray
#3
Indeed! I couldn’t understand it initially and now come to take a closer look - stupid me! lol
0 Likes
The implementation you had is a straight-forward version most interviewers and interviewees would prefer during interview (easy to implement and debug). Mine is originated from the skills I learned years ago as a programming contestant and is a little cryptic
1 Like