全站内容
medium
436. Find Right Interval
#Problem You are given an array of intervals, where intervals[i] = [startᵢ, endᵢ] and each startᵢ is unique. The right interval for an interval i is an interval j such that startⱼ >= endᵢ and startⱼ is minimized. Note that i may equal j. …
731. My Calendar II
#Problem You are implementing a program to use as your calendar. We can add a new event if adding the event will not cause a triple booking. A triple booking happens when three events have some non-empty intersection (i.e., some moment is …
581. Shortest Unsorted Continuous Subarray
#Problem Given an integer array nums, you need to find one continuous subarray such that if you only sort this subarray in non-decreasing order, then the whole array will be sorted in non-decreasing order. Return the shortest such subarray …
2559. Count Vowel Strings in Ranges
#Problem You are given a 0-indexed array of strings words and a 2D array of integers queries. Each query queries[i] = [lᵢ, rᵢ] asks us to find the number of strings present in the range lᵢ to rᵢ (both inclusive) of words that start and end …
729. My Calendar I
#Problem You are implementing a program to use as your calendar. We can add a new event if adding the event will not cause a double booking. A double booking happens when two events have some non-empty intersection (i.e., some moment is …
985. Sum of Even Numbers After Queries
#Problem You are given an integer array nums and an array queries where queries[i] = [valᵢ, indexᵢ]. For each query i, first, apply nums[indexᵢ] = nums[indexᵢ] + valᵢ, then print the sum of the even values of nums. Return an integer array …
767. Reorganize String
#Problem Given a string s, rearrange the characters of s so that any two adjacent characters are not the same. Return any possible rearrangement of s or return "" if not possible. https://leetcode.com/problems/reorganize-string/ Example 1: …
1765. Map of Highest Peak
#Problem You are given an integer matrix isWater of size m x n that represents a map of land and water cells. If isWater[i][j] == 0, cell (i, j) is a land cell. If isWater[i][j] == 1, cell (i, j) is a water cell. You must assign each cell a …
542. 01 Matrix
#Problem Given an m x n binary matrix mat, return the distance of the nearest 0 for each cell. The distance between two cells sharing a common edge is 1. https://leetcode.com/problems/01-matrix/ Example 1: case1Input: mat = …
1029. Two City Scheduling
#Problem A company is planning to interview 2n people. Given the array costs where costs[i] = [aCostᵢ, bCostᵢ], the cost of flying the iᵗʰ person to city a is aCostᵢ, and the cost of flying the iᵗʰ person to city b is bCostᵢ. Return the …