|
Wow, translating the algo into code was tricky! Debugging was
challenging, frustrating, and ultimately rewarding. Two debugging
takeaways I can think of now:
1. Make the test case small, so it's easy to trace the whole thing
through;
2. For bigger test case, the example from lecture notes was helpful. I
just needed to set breakpoint intelligently to see the min and max
arrays.
Also, initializing the min and max value, then use the Math.min and
Math.max was interesting. I may need to remember that, that's why I have
the notes here!
|