Leetcode Practice
LC 84. Largest Rectangle in Histogram
- Last updated
- Reading time
- 1 min read
The problem
Solution
function merge(nums1: number[], m: number, nums2: number[], n: number): void {
let nums1Pointer = m - 1
let nums2Pointer = n - 1
let mergePointer = nums1.length - 1
while (nums2Pointer >= 0) {
if (nums1[nums1Pointer] > nums2[nums2Pointer]) {
nums1[mergePointer] = nums1[nums1Pointer]
nums1Pointer--
} else {
nums1[mergePointer] = nums2[nums2Pointer]
nums2Pointer--
}
mergePointer--
}
}