@@ -0,0 +1,832 @@
+public class LeetCode0565 %7B%0A    public int arrayNesting(int%5B%5D nums)%0A    %7B%0A        if (nums == null %7C%7C nums.length == 0) %7B%0A            return 0;%0A        %7D%0A%0A        int result = 0;%0A        int half = nums.length %3E%3E 1;%0A        for (int i = 0; i %3C nums.length; i++) %7B%0A            int count = 0;%0A            for (int j = i; nums%5Bj%5D != -1; count++) %7B%0A                int tmp = nums%5Bj%5D;%0A                nums%5Bj%5D = -1;%0A                j = tmp;%0A            %7D%0A            if (count %3E half) %7B%0A                return count;%0A            %7D%0A            result = Math.max(result, count);%0A        %7D%0A        return result;%0A    %7D%0A%0A    public static void main(String%5B%5D args)%0A    %7B%0A        LeetCode0565 leetcode = new LeetCode0565();%0A        int%5B%5D nums = new int%5B%5D %7B 5, 4, 0, 3, 1, 6, 2 %7D;%0A        System.out.println(leetcode.arrayNesting(nums));%0A    %7D%0A%7D

Add LeetCode0565.java