title: Find the optimal path from an array of positive integers, such that the sum is max
body: <p>So given an array of <strong>positive integers</strong>, with <strong>n</strong> rows and <strong>m</strong> lines, I should find an algorithm that finds the path from the top of the array to the bottom of the array, <em>so that the sum of the path is maximized</em>.
  From any given point of that array, I can move downwards in 3 ways. Directly downwards, right-downwards and left-downwards. The array can also fold. That means that a left-downwards move that leads outside of the array (the cell is left at the array), can actually happen, but it leads to the left-downwards cell at the start of the array. The same happens if the cell is at the end of the array. I am given two example photos:
  <a href="https://i.stack.imgur.com/gQkID.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gQkID.png" alt="enter image description here" /></a></p>
  <p>The left array has a max sum of 44, and the right a max sum of 49.
  There are 3 possibles ways for me to go about this.</p>
  <ol>
  <li>Recursion</li>
  <li>Recursion with memorization</li>
  <li>Dynamic data structures.</li>
  </ol>
  <p>I started trying to complete the task by creating a tree. But I don't know if this will work. Can anyone suggest anything and/or give me a code snippet of how to start? (preferably in C)</p>