Showing 426 questions
Determine the total number of continuous subarrays within a given array that sum up to a specific target value, k.
#1. Subarray Sum Equals K
Find the length of the longest substring within a given string that contains no repeating characters. The substring must be contiguous.
#2. Longest Substring Without Repeating Characters
Given a number 'n', generate all possible well-formed (balanced) parentheses strings of length 2*n. For instance, if n=3, you need to create all valid combinations like '((()))', '(()())', etc.
#3. Generate Parentheses
You're given a sorted array that has been rotated, and a target value. Find the index of the target value in the rotated array, or return -1 if it's not present.
#4. Search in Rotated Sorted Array
Given a list of daily temperatures, find how many days you have to wait until a warmer temperature. Return a list where each element represents the waiting days for each day's temperature.
#5. Daily Temperatures
You are given an array where each element represents the maximum jump length from that position. Find the minimum number of jumps required to reach the last index.
#6. Jump Game II
Given an absolute file path (Unix style), simplify it by resolving redundant separators, directory names, and navigating back up the directory structure. Return the simplified canonical path.
#7. Simplify Path
Given a set of coin denominations and a target amount, find the minimum number of coins needed to reach that amount. You can assume you have an unlimited supply of each coin type.
#8. Coin Change
Determine if a string containing parentheses and asterisks is a valid parenthesis string. The asterisk can represent a left parenthesis, a right parenthesis, or an empty string.
#9. Valid Parenthesis String
Determine if four given points in a 2D plane form a valid square. A valid square has four equal sides and four right angles.
#10. Valid Square
You are given a grid of oranges, some fresh, some rotten. Rotten oranges contaminate adjacent fresh oranges; find the minimum time until all oranges are rotten.
#11. Rotting Oranges
Find the number of subarrays within a given array that contain exactly k odd numbers. A subarray is considered "nice" if it meets this condition.
#12. Count Number of Nice Subarrays
Given a grid representing land and water, count the number of distinct islands. An island is formed by connected land cells.
#13. Number of Islands
You're given a list of courses and their prerequisites. Determine a valid order in which you can take all the courses, respecting the dependencies. If it's impossible to finish all courses, indicate that.
#14. Course Schedule II
Design a data structure that acts as a Least Recently Used (LRU) cache. Implement methods to get and put key-value pairs, evicting the least recently used entry when the cache is full.
#15. LRU Cache
Find the length of the longest strictly increasing subsequence within a given array of numbers. A subsequence doesn't need to be contiguous, but the elements must maintain their original order.
#16. Longest Increasing Subsequence
You are given a collection of intervals. Merge all overlapping intervals into a single interval and return the result.
#17. Merge Intervals
Imagine a grid of land and water representing islands. Find the number of distinct island shapes, considering rotations and reflections as the same shape.
#18. Number of Distinct Islands
You are given a list of meeting time intervals. Determine the minimum number of conference rooms required to accommodate all the meetings without any overlap.
#19. Meeting Rooms II
Given an array representing the height of bars, calculate how much water can be trapped between them after rain. Think about finding the maximum height to the left and right of each bar.
#20. Trapping Rain Water