GoodScore SDE2 interview
Summary
I interviewed for an SDE2 position at GoodScore, discussed two coding problems, and was ultimately rejected.
Full Experience
-
Solved first using brute force: O(n log n) Then optimized to O(n) using a single-pass DP approach. Both approaches were discussed.
-
Initially solved using DP. The solution was accepted. The expected approach from the interviewer was BFS using a queue, since the problem can be modeled as a shortest‑path problem where each position is a state. Did not switch to the expected BFS approach during the interview.
Verdict: Rejected
Interview Questions (2)
Counting Bits
Given a non‑negative integer n, return an array ans of length n + 1 where ans[i] is the number of 1 bits in the binary representation of i.
For example, for n = 2, the answer is [0,1,1] because:
0in binary is0→ 0 set bits1in binary is1→ 1 set bit2in binary is10→ 1 set bit
Minimum Jumps to Reach Home
You are at position 0 on an infinite number line. Your home is at position home. You can make the following moves:
- Jump forward by a units.
- Jump backward by b units.
- Jump to any forbidden position listed in the array forbidden (these positions are blocked).
Find the minimum number of jumps required to reach home without landing on a forbidden position. If it is impossible, return -1.
Constraints typically include 0 <= forbidden.length <= 1000, 1 <= a, b, home <= 2000.