1365. Minimum Cycle Section
Given an array of int, find the length of the minimum cycle section.
Have you met this question in a real interview?
Example
Example 1
Input: [1,2,1,2,1,2]
Output: 2
Explanation:
The minimum cycle section is [1,2],and the length is 2.
Example 2
Input: [1,2,1,2,1]
Output: 2
Explanation:
The minimum cycle section is [1,2],and the length is 2, although the last 2 is not given, we still consider the cycle section is [1,2].
Example 3
Comments
Post a Comment