The phone screen for a Linux-oriented software engineering role included multiple coding tasks:
-
Transpose an
n x n matrix
Given a square matrix of size
n x n
, transform it so that rows become columns. In other words, return the matrix transpose, where
result[i][j] = matrix[j][i]
.
-
Design an object-oriented key-value store with
set, get, and setAll
Implement a key-value store supporting the following operations:
-
set(key, value)
: assign
value
to
key
-
get(key)
: return the current value for
key
, or indicate that the key does not exist
-
setAll(value)
: update all existing keys so that they now return
value
The design should be object-oriented. Discuss the expected time complexity of each operation, and implement the API efficiently.
A separate prompt mentioned reviewing a short C snippet and identifying bugs or issues, but the code itself was not provided, so that part is omitted here.