Skip to content

Commit 1f2585a

Browse files
refactor 565
1 parent b528176 commit 1f2585a

File tree

1 file changed

+0
-26
lines changed
  • src/main/java/com/fishercoder/solutions

1 file changed

+0
-26
lines changed

src/main/java/com/fishercoder/solutions/_565.java

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,5 @@
11
package com.fishercoder.solutions;
22

3-
/**
4-
* 565. Array Nesting
5-
*
6-
A zero-indexed array A consisting of N different integers is given. The array contains all integers in the range [0, N - 1].
7-
8-
Sets S[K] for 0 <= K < N are defined as follows:
9-
10-
S[K] = { A[K], A[A[K]], A[A[A[K]]], ... }.
11-
12-
Sets S[K] are finite for each K and should NOT contain duplicates.
13-
14-
Write a function that given an array A consisting of N integers, return the size of the largest set S[K] for this array.
15-
16-
Example 1:
17-
Input: A = [5,4,0,3,1,6,2]
18-
Output: 4
19-
Explanation:
20-
A[0] = 5, A[1] = 4, A[2] = 0, A[3] = 3, A[4] = 1, A[5] = 6, A[6] = 2.
21-
22-
One of the longest S[K]:
23-
S[0] = {A[0], A[5], A[6], A[2]} = {5, 6, 2, 0}
24-
Note:
25-
N is an integer within the range [1, 20,000].
26-
The elements of A are all distinct.
27-
Each element of array A is an integer within the range [0, N-1].
28-
*/
293
public class _565 {
304

315
public static class Solution1 {

0 commit comments

Comments
 (0)