pyassistant

Longest Subarray with Two Unique Integers

Given a list of integers, write a function to find the longest subarray that contains only 2 unique integers.

Example:

Input:
[1, 2, 3, 2, 2, 1, 4, 5]
Output:
[2, 1, 4, 5]

Make sure you return your solution, don't print!

AI

Bot

Trying to solve my challenge? Ask if you must, or press the purple button so I can analyze your code.