Solved! Leetcode 1732. Find the Highest Altitude

source: https://leetcode.com/problems/find-the-highest-altitude/description/ Find the Highest Altitude Table of ContentsFind the Highest AltitudeDescriptionExample 1:Example 2:Constraints:Solution Description There is a biker going on a road trip. The road trip consists of n + 1 points at different altitudes. The biker starts his trip on point 0 with altitude equal 0. You are given an integer array gain ...

Solved! Leetcode 2352. Equal Row and Column Pairs

source: https://leetcode.com/problems/equal-row-and-column-pairs/description/ Equal Row and Column Pairs Description Given a 0-indexed n x n integer matrix grid, return the number of pairs (ri, cj) such that row ri and column cj are equal. A row and column pair are considered equal if they contain the same elements in the same order (i.e., an equal array). ...

Solved! Leetcode 1150. Check If a Number Is Majority Element in a Sorted Array

source: https://leetcode.com/problems/check-if-a-number-is-majority-element-in-a-sorted-array/description/ Check If a Number Is Majority Element in a Sorted Array Table of ContentsCheck If a Number Is Majority Element in a Sorted ArrayDescriptionExample 1:Example 2:Constraints:Solution Description Given an integer array nums sorted in non-decreasing order and an integer target, return true if target is a majority element, or false otherwise. A majority ...

Solved! Leetcode 1146. Snapshot Array

source: https://leetcode.com/problems/summary-ranges/description/ Snapshot Array Table of ContentsSnapshot ArrayDescriptionExample 1:Constraints:Solution Description Implement a SnapshotArray that supports the following interface: SnapshotArray(int length) initializes an array-like data structure with the given length. Initially, each element equals 0. void set(index, val) sets the element at the given index to be equal to val. int snap() takes a snapshot of ...

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 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 ...