UBER Interview Experience (SDE 2 FE) L4 #uber #interview

uber logo
uber
· Software Development Engineer 2 (Frontend)
April 10, 2026 · 1 reads

Summary

I interviewed for a Software Development Engineer 2 (Frontend) position at Uber. The first round consisted of a medium‑level DSA problem about counting distinct infection sequences.

Full Experience

Round 1

The first round involved a medium-level DSA problem. The interviewer was friendly and made the discussion comfortable.

Problem Statement:

You are given an integer n representing the number of houses in a line, and an array initial_infected indicating the houses infected on day 0.

Each day, an infected house spreads the infection to its immediate neighbors (i-1 and i+1, if valid).

Return the number of distinct sequences in which all houses become infected.

Example

n = 8
initial_infected = [2, 7]

Output: 48

Explanation: Infection spreads outward from initially infected houses, forming segments of uninfected houses. Each segment can be infected in different valid orders. Edge segments (like [1] and [8]) have only one way. The middle segment [3,4,5,6] can be infected from both sides (2 and 7), so the infection order can interleave in multiple ways. Counting all valid interleavings gives the total number of sequences = 48.

Interview Questions (1)

1.

Count Distinct Infection Sequences

Data Structures & Algorithms·Medium

You are given an integer n representing the number of houses in a line, and an array initial_infected indicating the houses infected on day 0.

Each day, an infected house spreads the infection to its immediate neighbors (i-1 and i+1, if valid).

Return the number of distinct sequences in which all houses become infected.

Example

n = 8
initial_infected = [2, 7]

Output: 48

Explanation: Infection spreads outward from initially infected houses, forming segments of uninfected houses. Edge segments have only one possible infection order, while middle segments can be infected from both sides, leading to multiple interleavings. The total number of valid interleavings is 48.

📣 Found this helpful? Please share it with friends who are preparing for interviews!

Discussion (0)

Share your thoughts and ask questions

Join the Discussion

Sign in with Google to share your thoughts and ask questions

No comments yet

Be the first to share your thoughts and start the discussion!