Senior Backend Developer Interview Questions

741 senior backend developer interview questions shared by candidates

""" You are given a matrix as a list of lists, where the inner lists are the matrix rows. This is known as row-major format. Write a function sort_matrix(matrix, by_row) that sorts the matrix by an arbitrary row, such that the columns move along accordingly, when you sort by a certain column. * Don't use any imports or libraries. * Don't transpose the matrix! Example: For the matrix matrix = [[7, 0, 8, 2, 6], [1, 3, 0, 2, 4], [5, 4, 3, 2, 1]] we get: sort by row 0 [0, 2, 6, 7, 8] <- sorted row [3, 2, 4, 1, 0] <- columns moved by sorting – e.g. column (0,3,4) stay together [4, 2, 1, 5, 3] <- columns moved by sorting sort by row 1 [8, 7, 2, 0, 6] [0, 1, 2, 3, 4] <- sorted row [3, 5, 2, 4, 1] sort by row 2 [6, 2, 8, 0, 7] [4, 2, 0, 3, 1] [1, 2, 3, 4, 5] <- sorted row """
avatar

Senior Backend Developer

Interviewed at Babbel

3.5
Jul 11, 2023

""" You are given a matrix as a list of lists, where the inner lists are the matrix rows. This is known as row-major format. Write a function sort_matrix(matrix, by_row) that sorts the matrix by an arbitrary row, such that the columns move along accordingly, when you sort by a certain column. * Don't use any imports or libraries. * Don't transpose the matrix! Example: For the matrix matrix = [[7, 0, 8, 2, 6], [1, 3, 0, 2, 4], [5, 4, 3, 2, 1]] we get: sort by row 0 [0, 2, 6, 7, 8] <- sorted row [3, 2, 4, 1, 0] <- columns moved by sorting – e.g. column (0,3,4) stay together [4, 2, 1, 5, 3] <- columns moved by sorting sort by row 1 [8, 7, 2, 0, 6] [0, 1, 2, 3, 4] <- sorted row [3, 5, 2, 4, 1] sort by row 2 [6, 2, 8, 0, 7] [4, 2, 0, 3, 1] [1, 2, 3, 4, 5] <- sorted row """

Viewing 151 - 160 interview questions

Glassdoor has 741 interview questions and reports from Senior backend developer interviews. Prepare for your interview. Get hired. Love your job.