give integer array num return frequent elementIf tie return smallest if element return 1 example 1input num 0122441output 2explanationthe element 0 2 4 of 2 4 appear mostwe return small 2example 2input num 444924output 4Explanation 4 element appear mostExample 3input num 294721411337257output 1explanation there element Constraints1 numslength 20000 numsi 105