Doubt in bigwig problem

heyy, My doubt is related to bigwigs problem series:
the question is: You are given an array of positive and negative integers. If a number k at an index is positive, then move forward k steps. Conversely, if it’s negative (-k), move backward k steps. Since the array is circular, you may assume that the last element’s next element is the first element, and the first element’s previous element is the last element.

Determine if there is a loop (or a cycle) in array. A cycle must start and end at the same index and the cycle’s length > 1. Furthermore, movements in a cycle must all follow a single direction. In other words, a cycle must not consist of both forward and backward movements. Print 1 if cycle present else print 0.

Input Format
First Line Contains single integer n Second line contains n space separated integers.
on submission two test cases show tle.
please check:

hello @Aparna

your code is correct.
just convert all array elements between -n to n ( n is size of the array) before apply ur algorithm.
by taking modulo-> arr[i]=arr[i]%n;

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.