Trying to optimize nested loops

Just keep practicing! Now you have this trick in your toolbelt.