In Example Case 1, why is [2,3] not a subarray ?
# cook your dish here
for i in range(int(input())):
for j in range(n):
for k in range(i+1,n):
if l[k]>=l[j] and abs(l[j]-l[k])==1:
Learning course: Dynamic programming
Problem Link: CodeChef: Practical coding for everyone
[2,3] have values 4 and 2 which is decreasing order.
u don’t need to count these subarray in answer.
I’m so sorry but I don’t really understand.
Can you please elaborate it a little more
The values at index 2,3(considering 1 based indexing) are [4,2] which is not in increasing order so u need not to count such subarrays in your answer.