2
* @param {number[]} plantTime3
* @param {number[]} growTime7
var earliestFullBloom = function (plantTime, growTime) {8
// create array of plant indices to identify plants after sorting9
const plants = plantTime.map((v, i) => i);10
// sort plants by longest grow time11
const sortedByGrowTime = plants.sort((a, b) => growTime[b] - growTime[a]);13
// iterate over plants, planting those with longest grow time first14
// track the sum of plantTimes15
// Max of current plantTime sum + growTime[i] for all plants will be earliest bloom day18
for (const plant of sortedByGrowTime) {19
plantTimeSum += plantTime[plant];20
fullBloomDay = Math.max(fullBloomDay, plantTimeSum + growTime[plant]);