Friday, March 8, 2013

Christmas Tree Refactored

Well, here we are. Got a bit further today and refactored in order for the stump to be dynamically loaded as opposed to hard coded in with boolean logic(don't do this). This is an interview question I have heard is asked pretty often and it does have a couple tricky pieces to it, but the key is to have multiple variables that are equal to x at the top so when you want to count up and down at the same time they are not dependent on one another and change the code itself. Here is a picture with the command line and code itself:


No comments:

Post a Comment