Solved! Leetcode 228. Summary Ranges

source: https://leetcode.com/problems/summary-ranges/description/ Summary Ranges Table of ContentsSummary RangesDescriptionExample 1:Example 2:Constraints:Solution Description You are given a sorted unique integer array nums. A range [a,b] is the set of all integers from a to b (inclusive). Return the smallest sorted list of ranges that cover all the numbers in the array exactly. That is, each element of ...

Solved! Leetcode 744. Find Smallest Letter Greater Than Target

source: https://leetcode.com/problems/find-smallest-letter-greater-than-target/description/ Find Smallest Letter Greater Than Target Table of ContentsFind Smallest Letter Greater Than TargetDescriptionExample 1:Example 2:Example 3:Constraints:Solution Description You are given an array of characters letters that is sorted in non-decreasing order, and a character target. There are at least two different characters in letters. Return the smallest character in letters that is ...

Solved! Leetcode 1351. Count Negative Numbers in a Sorted Matrix

source: https://leetcode.com/problems/count-negative-numbers-in-a-sorted-matrix/description/ Count Negative Numbers in a Sorted Matrix Table of ContentsCount Negative Numbers in a Sorted MatrixDescriptionExample 1:Example 2:Constraints:SolutionFollow up Description Given a m x n matrix grid which is sorted in non-increasing order both row-wise and column-wise, return the number of negative numbers in grid. Example 1: Input: grid = [[4,3,2,-1],[3,2,1,-1],[1,1,-1,-2],[-1,-1,-2,-3]]Output: 8Explanation: There ...

Solved! Leetcode 1232. Check If It Is a Straight Line

Solved! Leetcode 1232. Check If It Is a Straight Line
source: https://leetcode.com/problems/check-if-it-is-a-straight-line/description/ Check If It Is a Straight Line Table of ContentsCheck If It Is a Straight LineDescriptionExample 1:Example 2:Constraints:Solution Description You are given an array coordinates, coordinates[i] = [x, y], where [x, y] represents the coordinate of a point. Check if these points make a straight line in the XY plane. Example 1: Input: ...

Solved! Leetcode 1091. Shortest Path in Binary Matrix

source: https://leetcode.com/problems/shortest-path-in-binary-matrix/description/ Shortest Path in Binary Matrix Table of ContentsShortest Path in Binary MatrixDescriptionExample 1:Example 2:Example 3:Constraints:Solution Description Given an n x n binary matrix grid, return the length of the shortest clear path in the matrix. If there is no clear path, return -1. A clear path in a binary matrix is a path ...

Solved! Leetcode 2101. Detonate the Maximum Bombs

Table of ContentsDetonate the Maximum BombsExample 1:Example 2:Example 3:Constraints:Solution source: https://leetcode.com/problems/detonate-the-maximum-bombs/ Detonate the Maximum Bombs You are given a list of bombs. The range of a bomb is defined as the area where its effect can be felt. This area is in the shape of a circle with the center as the location of the ...

Solved! Leetcode 785. Is Graph Bipartite?

source: https://leetcode.com/problems/is-graph-bipartite/description/ Is Graph Bipartite? There is an undirected graph with n nodes, where each node is numbered between 0 and n – 1. You are given a 2D array graph, where graph[u] is an array of nodes that node u is adjacent to. More formally, for each v in graph[u], there is an undirected ...

Solved! Leetcode 703. Kth Largest Element in a Stream

source: https://leetcode.com/problems/kth-largest-element-in-a-stream/description/ Kth Largest Element in a Stream Design a class to find the kth largest element in a stream. Note that it is the kth largest element in the sorted order, not the kth distinct element. Implement KthLargest class: KthLargest(int k, int[] nums) Initializes the object with the integer k and the stream of ...

Solved! Leetcode 253. Meeting Rooms II

source: https://leetcode.com/problems/meeting-rooms-ii/description/ Meeting Rooms II Given an array of meeting time intervals intervals where intervals[i] = [starti, endi], return the minimum number of conference rooms required. Example 1: Input: intervals = [[0,30],[5,10],[15,20]] Output: 2 Example 2: Input: intervals = [[7,10],[2,4]] Output: 1 Constraints: 1 <= intervals.length <= 104 0 <= starti < endi <= 106 ...

Solved! Leetcode 347. Top K Frequent Elements

source: https://leetcode.com/problems/top-k-frequent-elements/description/ Top K Frequent Elements Given an integer array nums and an integer k, return the k most frequent elements. You may return the answer in any order. Example 1: Input: nums = [1,1,1,2,2,3], k = 2 Output: [1,2] Example 2: Input: nums = [1], k = 1 Output: [1] Constraints: 1 <= nums.length ...