Take the following array of integers:
[60, 45, 30, 45, 45, 5, 60, 45, 30, 30, 45, 60, 60, 45, 30, 30, 60, 30, 30]
They need to be sorted into pairs of sub-arrays. The first sub-array in each pair must total at most 180, and the second must total at most 240.
How would you find the right combinations of elements so that no elements are remaining after all pairs have been created? I'm told that it is possible with this data set.