@@ -0,0 +1,1390 @@
+/**%0A * You and your friends are going trick-or-treating. Like everyone else, you want to %0A * get as much candy as possible. Like a true engineer, you want to optimize the route so that you%0A * don't have to walk too much.%0A *%0A * However, your mom said you can only hit one house per row so that you don't get kidnapped or worse, lost. %0A * To save yourself from walking too much, you are limited to choosing the house directly below it or the house %0A * at the exact diagonal to it.%0A *%0A * So if your neighborhood looked something like this:%0A * %5B%0A *   %5B a, b, c, d %5D,%0A *   %5B e, f, g, h %5D,%0A *   %5B i, j, k, l %5D,%0A * %5D%0A * From house a, the next possible houses are either e or f.%0A * From house b, the next possibles houses are e, f or g.%0A * From house c, the next possibles houses are f, g or h.%0A * From house d, the next possibles houses are g or h.%0A * From house g, the next possibles houses are i, k or l.%0A *%0A * Once you have reached the last row of houses, then you're done and head home.%0A *%0A * Given a matrix of houses and how much candy you can get at each house, find the maximum amount of candy you can%0A * get while following the rules above.%0A * %0A * Example:%0A * Input: %5B%0A *   %5B 3, 2, 4, 1 %5D,%0A *   %5B 5, 1, 6, 3 %5D,%0A *   %5B 1, 8, 2, 4 %5D,%0A *   %5B 2, 3, 1, 6 %5D%0A * %5D%0A * %0A * The maximum amount of candy you can get is 21 from the route 4 -%3E 6 -%3E 8 -%3E 3.%0A */%0Apublic int optimalRoute(int%5B%5D%5B%5D houses) %7B%7D

Add trick or treat problem