= minimum cost when the first popcount(mask) elements of nums1 have been assigned to the nums2 elements indicated by mask.
Base case: . No assignments made, zero cost. Transition: Let . For each unset bit , try assigning nums1[] to nums2[].
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
Dp[mask] alone
= minimum cost when the first popcount(mask) elements of nums1 have been assigned to the nums2 elements indicated by mask.
Base case: . No assignments made, zero cost. Transition: Let . For each unset bit , try assigning nums1[] to nums2[].