LogIn
I don't have account.

Meta(Facebook) Software Engineer Round 1 Interview Experience

Shashwat Tiwari
251 Views

#facebook

#meta

#interview-experience

  • Company: Meta
  • Role: Software Engineer
  • Interview Mode: Remote
  • Interview Duration: 60 Minutes
  • Coding Problems: 2
  • Difficulty Level: Medium

I recently interviewed for a Software Engineer position at Meta(Facebook). The process consisted of a single technical interview round conducted remotely. The interview lasted approximately one hour and focused entirely on coding and problem-solving.

The overall experience was professional and well-structured. The interviewer was friendly, clearly explained the problems and allowed me to discuss my thought process before jumping into implementation.

Round 1: Coding Interview

The entire round was dedicated to solving two coding problems. The interviewer expected not only correct solutions but also clear communication, complexity analysis and clean code implementation.

Problem 1: Sort Even and Odd Indices Independently

The first question involved sorting elements at even and odd indices separately while preserving their respective positions in the array.

At first glance, the problem looked straightforward, but it required careful handling of index positions and reconstruction of the final array after sorting.

My Approach

I first separated elements into two groups:

  • Elements at even indices
  • Elements at odd indices

After extracting them, I sorted both collections independently and then placed them back into their original index categories.

The discussion mainly focused on:

  • Time complexity analysis
  • Space complexity trade-offs
  • Edge case handling
  • Clean implementation

The interviewer seemed satisfied with both the approach and implementation.

Can Practice on LeetCode : 2164. Sort Even and Odd Indices Independently


class Solution {
    public int[] sortEvenOdd(int[] nums) {
        List<Integer> even = new ArrayList<>();
        List<Integer> odd = new ArrayList<>();
        for (int i = 0; i < nums.length; i++) {
            if (i % 2 == 0) {
                even.add(nums[i]);
            } else {
                odd.add(nums[i]);
            }
        }
        Collections.sort(even);
        odd.sort(Collections.reverseOrder());
        int evenIndex = 0;
        int oddIndex = 0;

        for (int i = 0; i < nums.length; i++) {
            if (i % 2 == 0) {
                nums[i] = even.get(evenIndex++);
            } else {
                nums[i] = odd.get(oddIndex++);
            }
        }
        return nums;
    }
}

Problem 2: Making a Large Island

The second problem was significantly more interesting and involved graph traversal concepts. The objective was to determine the largest possible island size in a binary grid after changing at most one water cell (0) into land (1).

This problem combines several concepts:

  • Graph traversal
  • DFS/BFS
  • Connected components
  • Hashing
  • Grid-based optimization

My Approach

I used a connected-component-based solution. The high-level idea was:

  1. Traverse the grid and assign a unique identifier to each island.
  2. Calculate and store the size of every island.
  3. For each water cell, examine neighboring islands.
  4. Compute the maximum possible island size if that cell were converted into land.

This approach avoids repeatedly traversing the same islands and provides an efficient solution.

Step 1: Label Existing Islands

Use DFS to:

  • Assign a unique island ID
  • Calculate island size
  • Store size in a map

Example:


Island 2 -> Size 5
Island 3 -> Size 4
Island 4 -> Size 7

Step 2: Try Converting Each Zero

For every 0 cell:

  • Check its four neighbors
  • Collect unique island IDs
  • Sum their sizes
  • Add 1 for the converted cell

Step 3: Return Maximum

  • Keep track of the maximum possible island size.

class Solution {

    private final int[][] DIRS = {
            {1, 0},
            {-1, 0},
            {0, 1},
            {0, -1}
    };

    public int largestIsland(int[][] grid) {
        int n = grid.length;
        Map<Integer, Integer> islandSize = new HashMap<>();

        int islandId = 2;
        int maxIsland = 0;

        // Label all islands
        for (int row = 0; row < n; row++) {
            for (int col = 0; col < n; col++) {
                if (grid[row][col] == 1) {
                    int size = dfs(grid, row, col, islandId);
                    islandSize.put(islandId, size);
                    maxIsland = Math.max(maxIsland, size);
                    islandId++;
                }
            }
        }

        // Try converting each zero
        for (int row = 0; row < n; row++) {
            for (int col = 0; col < n; col++) {
                if (grid[row][col] == 0) {
                    Set<Integer> neighbors = new HashSet<>();
                    int currentSize = 1;
                    for (int[] dir : DIRS) {
                        int nr = row + dir[0];
                        int nc = col + dir[1];
                        if (nr < 0 || nr >= n ||
                            nc < 0 || nc >= n) {
                            continue;
                        }
                        int id = grid[nr][nc];

                        if (id > 1 && neighbors.add(id)) {
                            currentSize += islandSize.get(id);
                        }
                    }
                    maxIsland = Math.max(maxIsland, currentSize);
                }
            }
        }

        return maxIsland == 0 ? n * n : maxIsland;
    }

    private int dfs(
            int[][] grid,
            int row,
            int col,
            int islandId) {

        int n = grid.length;
        if (row < 0 || row >= n ||
            col < 0 || col >= n ||
            grid[row][col] != 1) {
            return 0;
        }

        grid[row][col] = islandId;

        int size = 1;

        for (int[] dir : DIRS) {

            size += dfs(
                    grid,
                    row + dir[0],
                    col + dir[1],
                    islandId);
        }

        return size;
    }
}

We discussed:

  • DFS vs BFS trade-offs
  • Avoiding duplicate island counting
  • Complexity optimization
  • Handling edge cases such as fully connected grids

I was able to complete the implementation successfully and explain the reasoning behind each step.

Overall Experience

From a coding perspective, I felt the interview went well. I solved both problems completely, wrote working code and continuously communicated my thought process throughout the session.

The interviewer appeared engaged during the discussion and asked several follow-up questions around complexity and alternative approaches. I was able to answer those questions confidently and justify my design decisions.

Preparation Tips

If you're preparing for Meta Software Engineer interviews, I would recommend focusing on the following areas:

Master Core Coding Patterns

Meta frequently asks questions involving:

  • Arrays and Strings
  • Hash Maps
  • Two Pointers
  • Sliding Window
  • Graphs
  • Trees
  • DFS/BFS
  • Union-Find

Pattern recognition is often more valuable than memorizing individual solutions.

Practice Verbal Communication

Don't silently write code. Explain:

  • Why you're choosing a particular approach
  • Complexity trade-offs
  • Alternative solutions considered
  • Edge cases

Interviewers often evaluate your thought process as much as your final answer.

Write Production-Quality Code

Focus on:

  • Meaningful variable names
  • Modular functions
  • Readability
  • Proper edge-case handling

Clean code creates a strong engineering signal.

Review Graph Problems Thoroughly

The "Making a Large Island" problem reinforces how important graph traversal and connected-component techniques are for Meta interviews. Be comfortable with:

  • DFS
  • BFS
  • Union-Find
  • Grid traversal
  • Component labeling

Responses (0)

Write a response

CommentHide Comments

No Comments yet.