meta | Software Engineer | Interview Experience
Interview Date: Not specified
Result: Not specified
Difficulty: Not specified
Interview Process
The interview consisted of multiple coding questions focused on algorithm and data structure challenges. The format included live coding on a shared document, with the interviewer asking clarifying questions and discussing the approach during the coding process.
Technical Questions
-
Cost Minimization Problem
You are given two integer arrays of equal lengthDandR.Dis the cost of departing on dayi, andRis the cost of returning on dayi. You need to plan a round trip by choosing one departure day and one return day such that:- The return day is strictly after the departure day.
- The total cost is minimized.
Return the minimum possible total cost. If no valid trip exists, return -1.
Example:
D = [2, 5, 3, 4, 5] R = [5, 3, 5, 1, 6] Output: 3 Explanation: Depart on day 0 (cost 2), return on day 3 (cost 1). -
Pathfinding in a Grid
You are given a 2D grid where0represents an open cell and1represents a blocked cell. Starting at the top-left corner (0, 0), your goal is to reach the bottom-right corner (m-1, n-1). You can move up, down, left, or right, but cannot pass through cells with1.
Return any one valid path as a list of coordinates. If no path exists, return an empty list.
Example:grid = [[0, 0, 0], [0, 1, 0], [0, 0, 0]] Output: [(0,0), (0,1), (0,2), (1,2), (2,2)] -
Largest New Island Problem
You are given a 2D grid consisting of0sand1s, where1represents an existing island cell and0represents water. You want to create a new island by converting some0sinto1s, with the restriction that your new island must NOT be 4-directionally adjacent to any existing island cells.
Return the size of the largest possible new island you can create. If no valid new island can be formed, return 0.
Example:grid = [[1,0,0,0], [0,0,0,1], [0,0,0,0]] Output: 2 Explanation: The largest new island you can form is of size 2. -
Change Directory Command Implementation
Implement a function that mimics the behavior of the Linuxcd(change directory) command. You are given two paths:dir1(the current working directory) anddir2(the target path).- If
dir2starts with ‘/’, treat it as absolute and ignoredir1. - If
dir2is relative, apply it starting fromdir1. - Return the final absolute path.
Example:
dir1 = "/usr/bin" dir2 = "../lib" Output: "/usr/lib" - If
Tips & Insights
- Focus on understanding the problem requirements thoroughly before starting to code.
- Break down the problem into smaller parts and tackle them one at a time.
- Practice coding problems that involve arrays and grid traversal to prepare for similar questions in interviews.