Lyft Level 5 Challenge 2018 - Final Round C. Optimal Polygon Perimeter
3049. Earliest Second to Mark Indices II
You are given two 1-indexed integer arrays,
numsand,changeIndices, having lengthsnandm, respectively.Initially, all indices in
numsare unmarked. Your task is to mark all indices innums.In each second,
s, in order from1tom(inclusive), you can perform one of the following operations:
- Choose an index
iin the range[1, n]and decrementnums[i]by1.- Set
nums[changeIndices[s]]to any non-negative value.- Choose an index
iin the range[1, n], wherenums[i]is equal to0, and mark indexi.- Do nothing.
Return an integer denoting the earliest second in the range
[1, m]when all indices innumscan be marked by choosing operations optimally, or-1if it is impossible.
3048. Earliest Second to Mark Indices I
You are given two 1-indexed integer arrays,
numsand,changeIndices, having lengthsnandm, respectively.Initially, all indices in
numsare unmarked. Your task is to mark all indices innums.In each second,
s, in order from1tom(inclusive), you can perform one of the following operations:
- Choose an index
iin the range[1, n]and decrementnums[i]by1.- If
nums[changeIndices[s]]is equal to0, mark the indexchangeIndices[s].- Do nothing.
Return an integer denoting the earliest second in the range
[1, m]when all indices innumscan be marked by choosing operations optimally, or-1if it is impossible.
3047. Find the Largest Area of Square Inside Two Rectangles
There exist
nrectangles in a 2D plane. You are given two 0-indexed 2D integer arraysbottomLeftandtopRight, both of sizen x 2, wherebottomLeft[i]andtopRight[i]represent the bottom-left and top-right coordinates of theithrectangle respectively.You can select a region formed from the intersection of two of the given rectangles. You need to find the largest area of a square that can fit inside this region if you select the region optimally.
Return the largest possible area of a square, or
0if there do not exist any intersecting regions between the rectangles.
You are given an integer array
numsof even length. You have to split the array into two partsnums1andnums2such that:
nums1.length == nums2.length == nums.length / 2.nums1should contain distinct elements.nums2should also contain distinct elements.Return
trueif it is possible to split the array, andfalseotherwise**.