GIVEN AN ARREY OF INTIGER NUMBERS HAVE SIZE N
Answers
Answered by
7
arr[i] = ((i – 1) – k), where k is the index of arr[i – 1] that has appeared second most recently. This rule is applied when arr[i – 1] is present more than once in the array
arr[i] = 0. This rule is applied when arr[i – 1] is present only once or when i = 1.
#ADITYABHAIYT
Similar questions