From d8eb0d5710e8647aea84fe689c36ce177f0bcac5 Mon Sep 17 00:00:00 2001 From: "codez-bot[bot]" <142021456+codez-bot[bot]@users.noreply.github.com> Date: Sat, 19 Aug 2023 11:27:57 +0000 Subject: [PATCH] Added medium programming challenge with detailed problem statement, examples, and constraints. --- programming_interview/medium_challenge.md | 24 +++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 programming_interview/medium_challenge.md diff --git a/programming_interview/medium_challenge.md b/programming_interview/medium_challenge.md new file mode 100644 index 0000000..f9a2ea9 --- /dev/null +++ b/programming_interview/medium_challenge.md @@ -0,0 +1,24 @@ +# Medium Programming Challenge + +## Problem Statement +Write a function `find_longest_subarray` that takes a list of integers and returns the length of the longest contiguous subarray that contains only unique elements. + +## Input/Output Specifications +- Input: + - A list of integers `nums` (1 <= len(nums) <= 10^5) where -10^4 <= nums[i] <= 10^4. +- Output: + - An integer representing the length of the longest contiguous subarray with unique elements. + +## Examples +- Input: [1, 2, 3, 4, 5] + Output: 5 + +- Input: [1, 2, 2, 3, 4] + Output: 3 + +- Input: [5, 5, 5, 5, 5] + Output: 1 + +## Constraints +- The list will have at least one integer. +- The solution should have a time complexity of O(n), where n is the length of the input list.