just make the array like that ->->-> (low-> -> high -> -> low) So we can divide it by two part (low -> -> high)[fot LIS] & (high -> -> low)[reverse LIS] Example: 1 1 2 3 4 3 2 2 1 LIS = 1 1 2 3 4 3 2 2 1 Reverse LIS= 1 1 2 3 4 3 2 2 1 Example: 1 1 2 2 1 LIS = 1 1 2 2 1 Reverse LIS= 1 1 2 2 1 Example: 1 7 9 6 5 ...
I am Tanvir Ahmmad from Bangladesh. Working as a competitive programmer. It will be very pleasure to help you. Happy coding...