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: