My code:
n,m=map(int,input().split())
list=[int(item) for item in input().split()]
for i in range(0,n):
if abs(list[i]-list[i+1])>m:
print("1",end=" ")
else:
print("0",end=" ")
You are given with an circular array .Your task is calculate the difference between two consecutive number. And if difference is greater than ‘k’, print 1 else print 0
Input Description:
You are given two numbers ‘n’, ’m’. Next line contains n space separated integers.
Output Description:
Print 1 if the difference is greater than ‘m’.
Sample Input :
5 15
50 65 85 98 35Sample Output :
0 1 0 1 0
