Showing 16 questions
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.
#1. Meeting Rooms II
Design a data structure that efficiently finds the median of a dynamically growing stream of numbers. You need to implement methods to add new numbers and quickly retrieve the current median.
#2. Find Median from Data Stream
Given a sorted array, find the first and last position of a given target value. If the target is not found, return [-1, -1].
#3. Find First and Last Position of Element in Sorted Array
Given a list of words, group together all the anagrams. Anagrams are words that contain the same letters rearranged.
#4. Group Anagrams
Imagine a grid of land and water representing islands. Find the number of distinct island shapes, considering rotations and reflections as the same shape.
#5. Number of Distinct Islands
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.
#6. Longest Increasing Subsequence
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.
#7. Trapping Rain Water
The problem involves decoding a string that follows a specific encoding rule: k[encoded_string], where the encoded_string inside the square brackets is repeated exactly k times. Your task is to decode the string and return the decoded string.
#8. Decode String
Simulate a browser's history navigation. Implement functionalities to visit URLs, go back in history, and go forward.
#9. Design Browser History
Koko wants to eat all the bananas in some piles within a certain time. Find the minimum eating speed that allows her to finish on time.
#10. Koko Eating Bananas
Find two numbers in a given array that add up to a specific target value, and return their indices. Essentially, you need to efficiently locate the pair that satisfies the sum requirement.
#11. Two Sum
Implement a circular queue data structure with a fixed size. You'll need to handle enqueueing, dequeueing, and checking if the queue is full or empty efficiently.
#12. Design Circular Queue
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.
#13. LRU Cache
Determine if a string containing parentheses is valid. A valid string has matching and properly nested opening and closing parentheses.
#14. Valid Parentheses
Find all starting indices of substrings in a string `s` that are anagrams of a given string `p`. An anagram has the same letters, rearranged.
#15. Find All Anagrams in a String
Imagine a tree where the height is the longest path from the root to a leaf. Your goal is to find all possible roots that result in the minimum height of the entire tree.
#16. Minimum Height Trees