Back to problems

Matrix Transpose with Workers

Algorithm · Verkada · Easy

You are given a square 2D integer array matrix of dimensions $$n \times n$$, along with a positive integer numThreads. Your task is to compute the transpose of matrix — where rows become columns and columns become rows — by leveraging up to numThreads worker threads in parallel. Specifically, you must implement the function transpose(matrix). If numThreads is larger than the number of rows in the upper triangle of the matrix, the implementation is permitted to use fewer…

Checking your access…