Showing 13 questions
You're given a list of customer arrival and service times. Calculate the average waiting time for all customers, assuming they are served in the order they arrive.
#1. Average Waiting Time
Given a sorted array, find the first and last position of a given target value. If the target is not found, return [-1, -1].
#2. Find First and Last Position of Element in Sorted Array
Determine if every row and every column in a given square matrix contains all the numbers from 1 to n, where n is the size of the matrix. Effectively, check if it's a valid Sudoku (without subgrids).
#3. Check if Every Row and Column Contains All Numbers
Design a key-value store that supports storing values associated with timestamps. You should be able to retrieve the value for a given key at the latest timestamp less than or equal to a given time.
#4. Time Based Key-Value Store
You're given a sorted array of integers. Return a new array containing the squares of each number, also sorted in non-decreasing order.
#5. Squares of a Sorted Array
Determine if a string matches a pattern containing wildcard characters '?' (matches any single character) and '*' (matches any sequence of characters, including the empty sequence).
#6. Wildcard Matching
You are given a board of characters and a list of words. Find all the words from the list that can be formed by traversing adjacent cells on the board.
#7. Word Search II
You're given a list of events with start and end times. Determine the maximum number of events you can attend if you can only attend one event at a time.
#8. Maximum Number of Events That Can Be Attended
Given a collection of intervals, find the minimum number of intervals you need to remove to make the rest of the intervals non-overlapping.
#9. Non-overlapping Intervals
You are given a collection of intervals. Merge all overlapping intervals into a single interval and return the result.
#10. Merge Intervals
You're given a set of balloons represented by their start and end coordinates. Determine the minimum number of arrows needed to burst all the balloons.
#11. Minimum Number of Arrows to Burst Balloons
Determine if a given string represents a valid number (integer, decimal, or exponential). Consider all possible valid formats for numbers, including edge cases like signs, exponents, and decimal points.
#12. Valid Number
Determine if a given 9x9 Sudoku board is valid. Check if each row, column, and 3x3 subgrid contains the digits 1-9 without repetition.
#13. Valid Sudoku