1. Longest Subarray With Limited Difference
Problem
Given an integer array nums and an integer k, find the length of the longest contiguous subarray such that the absolute difference between the maximum and minimum elements in the subarray is less than or equal to k.
2. Decode String
Problem
Given an encoded string, return its decoded version.
The encoding rule is:
k[encoded_string]
The string inside the brackets must be repeated k times.
3. 3Sum
Problem
Given an integer array nums, return all unique triplets [nums[i], nums[j], nums[k]] such that:
i ≠ j ≠ k
nums[i] + nums[j] + nums[k] = 0
4. Valid Parentheses
Problem
Given a string containing only:
( ) { } [ ]
Determine if the string is valid.
A string is valid if:
Open brackets are closed by the same type
Open brackets are closed in the correct order
5. Longest Substring Without Repeating Characters
Problem
Given a string s, find the length of the longest substring without repeating characters.
6. Group Anagrams
Problem
Given an array of strings, group anagrams together.
Two strings are anagrams if they contain the same characters in a different order.
7. Task Scheduler
Problem
You are given CPU tasks represented by letters A–Z and a cooling period n.
The same task cannot run again until n intervals pass.
8. Minimum Window Substring
Problem
Given two strings s and t, find the smallest substring in s that contains all characters of t.
If no such substring exists, return empty string.
Return the minimum number of CPU intervals required to finish all tasks.