give 0indexed integer array num size n find maximum difference numsi numsj ie numsj numsi 0 j n numsi numsjreturn maximum difference if j exist return 1 example 1input num 7154output 4explanationthe maximum difference occur 1 j 2 numsj numsi 5 1 4note 1 j 0 difference numsj numsi 7 1 6 j validExample 2input num 9432output 1explanationthere j j numsi numsjExample 3input num 15210output 9explanationthe maximum difference occur 0 j 3 numsj numsi 10 1 9 Constraintsn numslength2 n 10001 numsi 109