[CodeSignal] Matrix Command Engine
Capital One interview questions · Medium · OA round · 6 tests
You are given an integer matrix grid and an ordered list of command strings.
Apply every command in order and return the final matrix.
Interface
runMatrixCommandEngine(
grid: number[][],
commands: string[],
): number[][]
Valid commands
reverseRow r- reverse the elements of rowr.swap r1 r2- swap rowsr1andr2.rotate- rotate the entire matrix 90 degrees clockwise.
Run your code with Ctrl+Enter to see results.