Hi @Design_Gurus. In the top down solution, when we Find LDS starting from ‘i’ to the end of the array
and then Find LDS starting from ‘i’ to the beginning of the array, we try to find the LDS by excluding the pivot element. This can create a solution where the length from the scan to the left include the pivot element but the scan to the right needed the pivot element excluded.
I’m thinking we should always include the pivot element when finding LDS (when prevIndex==-1). Is this thinking correct or am I missing something?
Take for e.g. the input 4,2,3,6,10,15,14,2,1 at pivot 10. Left scan will return 4 including 10 & right will return 4 excluding 10. Is it meaningful to sum the two together. We cant have one output that both includes and excludes 10.
Also, the output for 1,2,3,10 is 4, which is incorrect. It should be 0 or 3. Would we consider that an invalid input since it has no bitonic sequence?