title: Longest Increasing Odd Even Subsequence
signature: longestIncreasingOddEvenSubsequence :: [Integer] -> Integer -> Integer
  longestIncreasingOddEvenSubsequence arr n = 
test_code: import Text.Printf
  import Control.Exception (catch, SomeException)
  import Data.Typeable
  import qualified Data.List as List
  import qualified Data.Map as Map
  import qualified Data.Set as Set
  
  -- SOLUTION CODE
  -- ============================================
  
  PLACEHOLDER_CODE_BODY
  
  -- TESTING CODE 
  -- ============================================
  validateSolution :: Integer -> Integer -> Bool
  validateSolution actual expected = do
      actual == expected
  
  
  driver :: [Integer] -> Integer -> Integer -> String
  driver arr n expected = do
      if (validateSolution (PLACEHOLDER_FN_NAME arr n) expected)
          then "PASSED"
      else "FAILED"
  
  main = do
      printf "TEST-0...%s\n" (driver ([7, 8, 9, 16, 16, 27, 32, 33, 35, 35, 39, 39, 41, 42, 44, 47, 48, 50, 56, 59, 66, 69, 70, 73, 74, 76, 78, 87, 87, 89, 94, 96, 96, 98, 98]) (32) (18) )
  
      printf "TEST-1...%s\n" (driver ([40, 76, -54, -92, -28, -96, 8, 60, 28, -38, -62, -40, -16, 16, 52, 28, 70, -56, -50, 46, 68, -16, -56, 46, 42, 70, 52, -34, 86, -32, -50, 64, 36, 54, 20, 82, 84]) (25) (1) )
  
      printf "TEST-2...%s\n" (driver ([0, 0, 0, 0, 1, 1, 1]) (4) (1) )
  
      printf "TEST-3...%s\n" (driver ([15, 19, 87, 44, 15, 48, 21, 85, 90, 30, 88, 95, 48, 92, 29, 52, 46, 46, 7, 23, 96, 97, 43]) (19) (5) )
  
      printf "TEST-4...%s\n" (driver ([-98, -96, -94, -94, -94, -80, -80, -78, -64, -62, -62, -46, -42, -38, -36, -36, -34, -32, -20, -18, -16, -12, -8, -4, -4, -2, -2, 2, 6, 12, 34, 40, 42, 44, 46, 46, 50, 54, 58, 58, 70, 72, 72, 76, 78, 86]) (33) (1) )
  
      printf "TEST-5...%s\n" (driver ([0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1]) (13) (2) )
  
      printf "TEST-6...%s\n" (driver ([6, 7, 19, 36, 44, 63, 68, 72, 83]) (8) (5) )
  
      printf "TEST-7...%s\n" (driver ([-64, 12, 56, 50, 94, 6, 0, 70, -70, 46, -84, -64, 4, 76, 28, 94, -8, 24, 76, 64, -62, -34]) (15) (1) )
  
      printf "TEST-8...%s\n" (driver ([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) (21) (2) )
  
      printf "TEST-9...%s\n" (driver ([71, 57, 20, 8, 90, 69, 15, 62, 45, 14, 65, 20, 48, 9]) (10) (3) )
  
source_py: def longest_increasing_odd_even_subsequence(arr, n):
      lioes = list()
      maxLen = 0
      for i in range(n):
          lioes.append(1)
      i = 1
      for i in range(n):
          for j in range(i):
              if ((arr[i] > arr[j]) and (((arr[i] + arr[j]) % 2) != 0) and (lioes[i] < (lioes[j] + 1))):
                  lioes[i] = (lioes[j] + 1)
      for i in range(n):
          if (maxLen < lioes[i]):
              maxLen = lioes[i]
      return maxLen
source_cpp: int longest_increasing_odd_even_subsequence(vector<int> arr, int n) {
    int lioes [ n ];
    int maxLen = 0;
    for ( int i = 0;
    i < n;
    i ++ ) lioes [ i ] = 1;
    for ( int i = 1;
    i < n;
    i ++ ) for ( int j = 0;
    j < i;
    j ++ ) if ( arr [ i ] > arr [ j ] && ( arr [ i ] + arr [ j ] ) % 2 != 0 && lioes [ i ] < lioes [ j ] + 1 ) lioes [ i ] = lioes [ j ] + 1;
    for ( int i = 0;
    i < n;
    i ++ ) if ( maxLen < lioes [ i ] ) maxLen = lioes [ i ];
    return maxLen;
  }