Compressed Grid Operations
Pinterest interview questions · Hard · Coding round · 6 tests
Build a CompressedGrid class for sparse integer matrices. To save memory, it
should hold on to the non-zero entries only.
Interface
class CompressedGrid {
constructor(matrix: number[][])
add(other: number[][]): number[][]
multiply(other: number[][]): number[][]
}
Requirements
Run your code with Ctrl+Enter to see results.