you n flower seed every seed plant begin grow bloom planting seed take time growth seed you give 0indexed integer array planttime growTime length n eachplanttimei number day take plant ith seed every day work plant exactly seed you work planting seed consecutive day planting seed complete work plantTimei day plant totalgrowtimei number day take ith seed grow completely plant after day growth flower bloom stay bloomed foreverfrom begin day 0 plant seed orderreturn early possible day seed bloom Example 1input planttime 143 growTime 231output 9explanation the gray pot represent planting day colored pot represent grow day flower represent day bloomsOne optimal way ison day 0 plant 0th seed the seed grow 2 day bloom day 3on day 1 2 3 4 plant 1st seed the seed grow 3 day bloom day 8on day 5 6 7 plant 2nd seed the seed grow 1 day bloom day 9thus day 9 seed bloomingExample 2input planttime 1232 growtime 2121output 9explanation the gray pot represent planting day colored pot represent grow day flower represent day bloomsOne optimal way ison day 1 plant 0th seed the seed grow 2 day bloom day 4on day 0 3 plant 1st seed the seed grow 1 day bloom day 5on day 2 4 5 plant 2nd seed the seed grow 2 day bloom day 8on day 6 7 plant 3rd seed the seed grow 1 day bloom day 9thus day 9 seed bloomingExample 3input planttime 1 growTime 1output 2explanation on day 0 plant 0th seed the seed grow 1 day bloom day 2thus day 2 seed bloom Constraintsn planttimelength growtimelength1 n 1051 plantTimei growTimei 104