2020-04-30 20:39:39 +02:00
2020-04-30 20:39:39 +02:00
2020-05-16 22:55:19 +02:00
2020-04-30 20:39:39 +02:00
2020-04-30 20:39:39 +02:00
2020-04-30 20:39:39 +02:00
2020-04-30 21:17:31 +02:00
2020-04-30 21:17:31 +02:00

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
No description provided
Readme 89 KiB
Languages
Java 96.2%
CSV 2.1%
Gradle 1.7%