Showing 8 questions
You are given a collection of intervals. Merge all overlapping intervals into a single interval and return the result.
#1. Merge Intervals
You're given a set of coins, each with a different probability of landing heads. Determine the probability of getting a specific number of heads after tossing all the coins.
#2. Toss Strange Coins
Design a system where users can upload files and share them with others. The system should handle downloading files and tracking which users own specific file copies.
#3. Design a File Sharing System
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.
#4. LRU Cache
Given a string of digits, return all possible letter combinations that the number could represent, using the typical phone keypad mapping. The goal is to generate all valid combinations in any order.
#5. Letter Combinations of a Phone Number
You are given a list of email addresses. Determine how many different addresses actually receive emails after applying a set of simplification rules to filter out spam.
#6. Unique Email Addresses
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.
#7. Find Median from Data Stream
Write a function that reverses only the vowels within a given string. The consonants should remain in their original positions.
#8. Reverse Vowels of a String