Dsa
Arrays
Easy
Longest Subarray with Unique Elements
Given an array of integers, find the length of the longest subarray that contains all unique elements.
Example:
Input:
7
1 2 3 2 4 5 1
Output:
5
Key concepts
arrayssubarrayhashing
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now