I've got a function that returns a nested list such as [[1,2], [2,3], [5,6]]. To find all unions inside the nested list I've tried using sets unions but I'm not sure how to filter down in a loop as the size of the nested list is not constant.
Is there a way through list comprehenision or nested for loops?
Examples:
Given the input [[1,2], [2,3], [5,6]] --> the output would be [[1,2,3], [5,6]]
[[0], [2, 5, 6], [1, 3, 5], [2, 4], [3, 5], [1, 2, 4], [1]] --> [[0], [1,2,3,4,5,6]]