[Python] How can you remove superset lists from a list of lists in Python?

Discussão em 'Python' iniciado por Stack, Dezembro 22, 2024.

  1. Stack

    Stack Membro Participativo

    I have a list of lists in Python like the following:

    [[1,2,3],[2,3],[2,4,3],[4,5],[5]]


    I want to remove all the inner lists that are a superset (a list that contain all the elements of another list, but with additional elements) of another inner list. For the example above, removing the supersets should result in the following:

    [[2,3],[5]]


    How can I accomplish this?

    Continue reading...

Compartilhe esta Página