This commit is contained in:
linarphy 2023-05-09 12:31:32 +02:00
parent 3bcc5b9f50
commit ba1a591669
No known key found for this signature in database
GPG key ID: 3D4AAAC3AD16E79C

View file

@ -182,7 +182,7 @@ def consecutive( list_ ):
index = last_consecutive( list_ ) index = last_consecutive( list_ )
if index == len( list_ ) - 1: if index == len( list_ ) - 1:
return [ list_ ] return [ list_ ]
return consecutive( list_[ : i + 1 ] ) + consecutive( list_[ i + 1 : ] ) # happy recursion \o/ return consecutive( list_[ : index + 1 ] ) + consecutive( list_[ index + 1 : ] ) # happy recursion \o/
def last_consecutive( list_ ): def last_consecutive( list_ ):
""" """
return the last index of the first consecutive list return the last index of the first consecutive list