you give integer array num length n integer numslots 2 numslot n there numslots slot number 1 numslotsyou place n integer slot slot contain number the and sum give placement sum bitwise and number respective slot numberfor example and sum place number 1 3 slot 1 4 6 slot 2 equal 1 and 1 3 and 1 4 and 2 6 and 2 1 1 0 2 4return maximum possible and sum num give numslots slot Example 1input num 123456 numslot 3output 9explanation one possible placement 1 4 slot 1 2 6 slot 2 3 5 slot 3 this give maximum and sum 1 and 1 4 and 1 2 and 2 6 and 2 3 and 3 5 and 3 1 0 2 2 3 1 9example 2input num 1310471 numslot 9output 24explanation one possible placement 1 1 slot 1 3 slot 3 4 slot 4 7 slot 7 10 slot 9This give maximum and sum 1 and 1 1 and 1 3 and 3 4 and 4 7 and 7 10 and 9 1 1 3 4 7 8 24note slot 2 5 6 8 permit Constraintsn numslength1 numslot 91 n 2 numslots1 numsi 15