Needed one clarification regarding second test case.
1 2 1 is the given sequence. As per the question, 1 2 1 and 2 1 both are sub-sequence. As per the condition, in any sub-sequence a[i] < a[i+1]. Then both will not be AP sequence. how come ans is 1. Pls explain where iβm wrong.
I think you should first study about AP.
1 Like
2 1 is an AP⦠infact any sequence of two terms is always an AP
i didnβt get this part.
Sequence s[1],ββs[2],βββ¦,ββs[k] is called a subsequence of sequence a[1],ββa[2],βββ¦,ββa[n], if there will be such increasing sequence of indices i[1],βi[2],ββ¦,βi[k] (1βββ€ββi[1]ββ<ββi[2]ββ<ββ¦ ββ<ββi[k]βββ€ββn), that a[i[j]]ββ=ββs[j].
1 2 1 is a sub-sequence but not AP β¦ thatβs why the answer is 1 β¦