Facebook | Phone | Transitive reduction & Factorial Trailing Zeroes

Difficulty: MEDIUMCategory: InterviewExperienceFrequency: 1Asked On 2020-05-13Added By Anonymous
Source: Link

Company: Meta
Role: e3
Interview Stage: Phone Screen
Location: unknown
Year: unknown

Original Post Content:

Question 1:
Given a directed graph remove return minimum of edges to keep all paths.

Example:
Input: [[1, 2], [1, 3], [1, 4], [2, 3], [2, 4], [3, 4]]
Output: 3
Explanation: Minimum number of edges is 3 (1 2, 2 3, 3 4)

Before
Before graph image

After
After graph image

Question 2:
https://leetcode.com/problems/factorial-trailing-zeroes/

The second one was very easy but for the first one I used a sort of dfs with some custom node but the interviewer doesn't seem to be so happy...

Comments