title: Find increasing and decreasing subsequence in an array Python
body: <p>I have a little complicated problem. </p>
  
  <p>I have this array [34,33,5,78,50,76,82,95,119,31,49,76] and I need to find all the longest increasing and decreasing subsequences.
  For example, the longest decreasing subsequence you can find has a lenght of three. Then, I need to find all the subsequence with that lenght, e.g: [78,76,76] or  [78,50,31] or [34,33,31] etc..</p>
  
  <p>I've been trying to create an algorithm in python that, given an array in input, it returns all the longest decreasing and increasing subsequences, for a while but I couldn't succeed.
  I've written this so far, </p>
  
  <pre><code>def find_decreasing(seq):
  found=[]
  for v in seq[:-1]:        
      for iv in found[:]:
          if v &gt; iv[0]:
              found.append([v+1]+iv)
      found.append([v])
  return found
  </code></pre>
  
  <p>But it doesn't work
  May you help me?</p>
  
  <p>Thanks for your attention.</p>