1p3a Experience · Mar 2026 · Los Angeles

LinkedIn Software Engineer IC2 DSA Loop Interview Experience

SWE Onsite

Interview Experience

This was 2nd round of DSA with LinkedIn. Duration - 60 mins Number of Questions - 2 1. Max consecutive 1's in circular format. https://leetcode.com/problems/max-consecutive-ones-ii/description/ replac

Full Details

This was 2nd round of DSA with LinkedIn. Duration - 60 mins Number of Questions - 2 1. Max consecutive 1's in circular format. https://leetcode.com/problems/max-consecutive-ones-ii/description/ replacing 1's with 0s to form the largest island.

Solution :

public int largestIslandCircular(int[] nums, int k) { int n = nums.length; int left = 0; int zeros = 0; int maxIsland = 0; for (int right = 0; right < 2 * n; right++) { // Use modulo to simulate circularity if (nums[right % n] == 0) { zeros++; } while (zeros > k || (right - left + 1) > n) { if (nums[left % n] == 0) { zeros--; } left++; } maxIsland = Math.max(maxIsland, right - left + 1); if (maxIsland == n)

**return** n; }

**return** maxIsland; }
  1. Variation of https://leetcode.com/problems/find-k-closest-elements/description/

Solution :

public List<Integer> closestKValues(TreeNode root, double target, int k) { Deque<Integer> dq = new ArrayDeque<>(); // Start the optimized in-order traversal inorder(root, target, k, dq);

**return** new ArrayList<>(dq); } private boolean inorder(TreeNode node, double target, int k, Deque<Integer> dq) { if (node == null)

**return** true; if (!inorder(node.left, target, k, dq))

**return** false; if (dq.size() < k) { dq.addLast(node.val); } else { if (Math.abs(node.val - target) < Math.abs(dq.peekFirst() - target)) { dq.removeFirst(); dq.addLast(node.val); } else { // all nodes to the right are also further.

**return** false; } }

**return** inorder(node.right, target, k, dq); }

About This Question

This is a candidate experience report from a linkedin interview for a swe role during the onsite round reported in 2026.

It covers the following topics: Binary Tree, Arrays, Queue, Stack .