Pregunta de entrevista de TikTok

Similar to Longest Increasing Path in Matrix problem