you give 0indexed integer array num for index 1 numslength 2 beauty numsi equals2 numsj numsi numsk 0 j k numslength 11 numsi 1 numsi numsi 1 previous condition satisfied0 previous condition holdsReturn sum beauty numsi 1 numslength 2 Example 1input num 123output 2explanation for index range 1 1 the beauty nums1 equal 2example 2input num 2464output 1explanation for index range 1 2 the beauty nums1 equal 1 the beauty nums2 equal 0example 3input num 321output 0explanation for index range 1 1 the beauty nums1 equal 0 constraints3 numslength 1051 numsi 105