title: how to find the maximum subsequence sum in a circular linked list
body: <p>I am aware of the maximum subarray sum problem and its O(n) algorithm. This questions modifies that problem by using a circular linked list:</p>
  
  <p><strong>Find the sequence of numbers in a circular linked list with maximum sum.</strong><br>
  <strong>Now what if sum of all entries is zero?</strong></p>
  
  <p>To me, the only approach is to modify the array solution and have the algorithm loop around and start over at the beginning at the list once the first iteration is done. Then do the same thing for up to 2 times the entire list and find the max. The down side is that there might be many very tricky to handle if I do it this way, for example, if the list looks like:</p>
  
  <p>2 - 2 - 2 - 2 back to front</p>
  
  <p>Then it's very tricky to not include the same element twice</p>
  
  <p>Is there a better algorithm? </p>
  
  <p>Thanks!!</p>