you give 0indexed integer array num length power 2apply follow algorithm numslet n length num if n 1 end process otherwise create new 0indexed integer array newnums length n 2for index 0 n 2 assign value newNumsi minnums2 nums2 1for odd index 0 n 2 assign value newNumsi maxnums2 nums2 1Replace array num newnumsrepeat entire process start step 1return number remain num apply algorithm Example 1input num 13524822output 1explanation the follow array result apply algorithm repeatedlyFirst num 1542second num 14Third num 11 remain number return 1example 2input num 3output 3explanation 3 remain number return 3 Constraints1 numslength 10241 numsi 109numslength power 2