give array num positive integer return long possible length array prefix num possible remove exactly element prefix number appear number occurrencesif remove element remain element consider appear number number ocurrence 0 example 1input num 22115335output 7explanation for subarray 2211533 length 7 remove nums4 5 221133 number appear exactly twiceexample 2input num 1112223334445output 13 constraints2 numslength 1051 numsi 105