Facebook | Phone Screen | SDE

Difficulty: MEDIUMCategory: InterviewExperienceFrequency: 1Asked On 2020-09-27Added By Anonymous
Source: Link

Company: Meta (Facebook)
Role: e3, e4
Interview Stage: Phone Screen
Location: unknown
Year: unknown

Original Post Content:

Given a matrix of size m x n,
Find the longest path in the matrix from (0, 0) to (m, n).

You can move in 4 directions: up, down, left, right.
Visit each (i, j) once only.
n, m <= 10^5

Example, for 3x3 => Ans: 8. (don't count (0, 0))
Example, for 2x2 => Ans: 2. (don't count (0, 0))

Comments