i couldn't understand this problem solution okay i understand that he get the LIS in nlogn twice from both sides preprocess for the length of increasing subsequence till now then he makes a loop and calculate the min of LIS from both sides what i don't understand is how he guaranteed that the LIS max number will be smaller than ith element in the original array.
problem https://uva.onlinejudge.org/external/105/10534.pdf
solution https://github.com/Diusrex/UVA-Solutions/blob/master/10534%20Wavio%20Sequence.cpp