Simple MDPyramid script in R. Delivers possible route with maximum sums.
The task to find the maximum sum of the numbers per the given rules below:
- You will start from the top and move downwards to an adjacent number as in below.
- You are only allowed to walk downwards and diagonally.
- You should walk over the numbers as evens and odds subsequently. Suppose that you are on an even number the next number you walk must be odd, or if you are stepping over an odd number the next number must be even. In other words, the final path would be like Odd -> even -> odd -> even …
- You must reach to the bottom of the pyramid.
The goal is to find the maximum sum if you walk the path.
- This is v03
- added test with random numbers and random matrix sizes