This is a slight Modification of the Main algorithm . We just need to add one more extra condition to maintain this . All except this condition is exactly the same . We just need to check the If it is Even/Odd according to the need of the Question .
I will solve the Question by assuming the need was to find Longest Increasing Even Subsequence