[Python] List all contiguous sub-arrays

Discussão em 'Python' iniciado por Stack, Fevereiro 2, 2025.

  1. Stack

    Stack Membro Participativo

    I have an array [1, 2, 3] of integer and I need to return all the possible combination of contiguous sub-arrays of this array.

    [[1],[2],[3],[1,2],[2,3],[1,2,3]]

    How can I handle that with python? One way would be to have 2 loops and the array itself but there should be a better way.

    Continue reading...

Compartilhe esta Página