package leetcode;

/**
 * https://leetcode.com/problems/circular-array-loop/
 */
public class Problem457 {
    public boolean circularArrayLoop(int[] nums) {
        // TODO
        return false;
    }

    public static void main(String[] args) {
        Problem457 prob = new Problem457();
        System.out.println(prob.circularArrayLoop(new int[]{2, -1, 1, 2, 2})); // true
        System.out.println(prob.circularArrayLoop(new int[]{2, -1, 1, 1, 2})); // false
        System.out.println(prob.circularArrayLoop(new int[]{-1, 2})); // false
        System.out.println(prob.circularArrayLoop(new int[]{-1, 1})); // false
        System.out.println(prob.circularArrayLoop(new int[]{-1, -2})); // false
        System.out.println(prob.circularArrayLoop(new int[]{-1, -1, -2})); // true
        System.out.println(prob.circularArrayLoop(new int[]{1, -1})); // false
        System.out.println(prob.circularArrayLoop(new int[]{3, 1, 2})); // true
        System.out.println(prob.circularArrayLoop(new int[]{2, 1, -1, -2, -2})); // false
    }
}

@@ -163,15 +163,608 @@
     
-// TODO
+boolean%5B%5D visited = new boolean%5Bnums.length%5D;%0A        for (int i = 0; i %3C nums.length; i++) %7B%0A            if (visited%5Bi%5D) %7B%0A                continue;%0A            %7D%0A            visited%5Bi%5D = true;%0A            int start = i;%0A            int j = i + 1;%0A            boolean found = true;%0A            while (j != start) %7B%0A                if (nums%5Bi%5D %3C 0 != nums%5Bj%5D %3C 0) %7B%0A                    found = false;%0A                %7D%0A                visited%5Bj%5D = true;%0A                j++;%0A                j %25= nums.length;%0A            %7D%0A            if (found) %7B%0A                return true;%0A            %7D%0A        %7D
 %0A   
@@ -957,32 +957,34 @@
 , 2%7D)); // true%0A
+//
         System.o
@@ -1047,32 +1047,34 @@
  2%7D)); // false%0A
+//
         System.o
@@ -1128,32 +1128,34 @@
  2%7D)); // false%0A
+//
         System.o
@@ -1209,32 +1209,34 @@
  1%7D)); // false%0A
+//
         System.o
@@ -1291,32 +1291,34 @@
 -2%7D)); // false%0A
+//
         System.o
@@ -1376,32 +1376,34 @@
  -2%7D)); // true%0A
+//
         System.o
@@ -1461,24 +1461,26 @@
 ); // false%0A
+//
         Syst
@@ -1547,16 +1547,18 @@
 // true%0A
+//
         

Update problem 457