Ok I started to move on, but wanted to finish up ps2_4. I pretty much have it, but for some reason, I can't get the 20piece to come up to be added to 6 piece or 9 piece. It has to be something simple... so simple it evades me. Can anyone help me out? http://codepad.org/ZyNL4F1s
hmmm, you made that pretty complicated. it is really hard to tell what is going on. however, you have a break at line thirty-one that has the same indentation as your your 'for b...' statement (line twenty-three). looks like that will cause the c loop to 'stop' - this will not let c go to the next c.
could you advise me in how to make it less complicated? i actually thought it was more explanatory than I have done in the past, but that doesn't mean anything if it's still confusing. Are you referring to the code, the comments, or the whole thing? Thanks!
it is hard to follow how the execution will flow - i stopped trying to figure it out here is one way, http://codepad.org/HuCBmLMg
i think i just try to keep it simple and don't try to optimize the code for efficiency. after i get it to run correctly, if it is tooo slow, i go back and tweak it
Nice! thanks for the feedback
hi! i have just written another solution. it is longer than the one posted by bwCA - but it is bound to run faster, since avoids the 3 nested for loops, and actually skips the rest of the exhaustive search once one combination is found. i do not think that efficiency should be much of a concern at this stage of the course... anyway i was surprised about how different solutions we came up with! http://codepad.org/4zrsw27u
Join our real-time social learning platform and learn together with your friends!