Showing 19 questions
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.
#1. Coin Change
Find the most frequent word in a given paragraph, excluding a list of banned words. Return the most common word after performing case-insensitive comparison and removing punctuation.
#2. Most Common Word
Find the maximum depth (number of nodes along the longest path from the root) of an N-ary tree. Each node can have multiple children.
#3. Maximum Depth of N-ary Tree
Determine if a given abbreviation is valid for a given word. An abbreviation can contain digits representing the number of skipped characters.
#4. Valid Word Abbreviation
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.
#5. Design Circular Queue
You are given a list of people's available time slots and a meeting duration. Find the earliest time slot that works for all participants to hold the meeting.
#6. Meeting Scheduler
You're given lists of favorite companies for several people. Identify the people whose list of favorite companies is not a subset of any other person's list.
#7. People Whose List of Favorite Companies Is Not a Subset of Another List
Find the median of all sliding windows of a given size within an array of numbers. The window slides one position at a time from left to right.
#8. Sliding Window Median
You're given a schedule of available flights and vacation days for different cities across multiple weeks. Find the maximum number of vacation days you can take by strategically planning your travel between cities each week.
#9. Maximum Vacation Days
Design a data structure that supports adding words and searching for words. The search method can handle wildcard characters, allowing you to find words that match a pattern.
#10. Design Add and Search Words Data Structure
Find the maximum sum of any path in a binary tree, where a path can start and end at any node. The path must contain at least one node.
#11. Binary Tree Maximum Path Sum
You are a robber planning to rob houses along a street. Maximize your loot, but be careful - adjacent houses have connected security systems that will trigger an alarm if you rob them both.
#12. House Robber
You are a robber planning to rob houses along a circular street. Determine the maximum amount of money you can rob without robbing adjacent houses, considering the first and last house are neighbors.
#13. House Robber II
Determine if a set of points forms a perfect straight line. You're given the coordinates of several points; check if they all lie on the same line.
#14. Check If It Is a Straight Line
You're given a list of words and a string of characters. Determine which words can be fully formed using only the characters from the given string, and return the sum of their lengths.
#15. Find Words That Can Be Formed by Characters
Given a binary tree and a target sum, determine if there exists a path from the root to a leaf such that the sum of all the values along the path equals the target sum.
#16. Path Sum
You are given an array of strings. Calculate the difference between the ASCII values of consecutive characters in each string. Identify the string with a unique difference array and return it.
#17. Odd String Difference
You are given two strings. Find the largest string that divides both of them (i.e., can be concatenated to form each string).
#18. Greatest Common Divisor of Strings
Transform a binary search tree so that each node's value is the sum of all nodes greater than or equal to it in the original tree. You'll need to modify the BST in-place to achieve this.
#19. Binary Search Tree to Greater Sum Tree