Cannot understand the error in my code

For maximum bitonic subsequence problem cannot understand my error. This is my solution—https://ide.codingblocks.com/s/330560

Anyone please reply???

You are writing an O(n^2) approach,O(n) approach exists.

It gives wrong answer for small input. I have used LIS and then LDS.

Yes But decreasing subsequence should be taken from right.
at any point LIS + LDS(from right) -1 should be the answer.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.