A very absurd description for this problem, but people can get the idea by looking at the examples....
bool circularArrayLoop(vector<int>& nums) { int n = nums.size(); int curr = 0, next = 0; // 2 points for (int start = 0, size_cnt = 0; start < n; ){ //syntax curr = next; next = (curr +(nums[curr] %n )+n )%n; if (++size_cnt >n || nums[curr] * nums[next] < 0 || next == curr){ next = ++start; size_cnt =0; } else if (next == start){return true;} } return false; } Also more advanced solution can apply~ 标签:Leetcode457,curr,nums,int,next,start,size From: https://www.cnblogs.com/selfmade-Henderson/p/17020886.html