add solution for convert matrix problem of pinterest interview