you give 0indexed 2D integer array pair pairsi starti endi an arrangement pair valid index 1 pairslength endi1 startireturn valid arrangement pairsNote the input generate exist valid arrangement pair example 1input pair 514511994output 119944551explanationthis valid arrangement endi1 equal startiend0 9 9 start1 end1 4 4 start2end2 5 5 start3example 2input pair 133221output 133221explanationthis valid arrangement endi1 equal startiend0 3 3 start1end1 2 2 start2the arrangement 211332 322113 validExample 3input pair 121321output 122113explanationthis valid arrangement endi1 equal startiend0 2 2 start1end1 1 1 start2 Constraints1 pairslength 105pairsilength 20 starti endi 109starti endino pair exactly sameThere exist valid arrangement pair