DEV Community

Discussion on: Daily Challenge #72 - Matrix Shift

Collapse
 
teaglebuilt profile image
dillan teagle

quick python solution and headache for the rest of the day


def shift_matrix(matrix):
    arr = [i for row in matrix for i in row]
    print(arr)
    result = sorted(arr, key=lambda x: x == arr[-1], reverse=True)]
    return result


m = [['d','u','d','e'], ['i','m','c','o'], ['d','i','n','g']]
shift_matrix(m)