forked from code-clash/find-longest-distinct-subarray
Find Longest Distinct Sub-Arrray
Goal
Given an array, find and return the length of the longest sub-array with the property that all its elements are distinct.
Hint: simple solutions may perform in time complexity O(n^3) or O(n^2) but solutions in O(n) are possible.
Input
A blank-separated array arbitrary symbols.
Output
The length of the longest distinct sub-array
Constraints
- 1 <=
array-length
<= 50
Example
Input:
f s f e t w e n w e
Output:
5
(the longest distinct sub-array is s f e t w
)
Description
Languages
Java
96.2%
CSV
2.1%
Gradle
1.7%