Google OA/Phonescreen [L4] - 24 Dec 2025

google logo
google
Ongoing
December 24, 202569 reads

Summary

I recently completed my Online Assessment and Phonescreen for a Software Engineer L4 role at Google, facing three distinct algorithmic challenges.

Full Experience

I recently participated in the Google Online Assessment and a subsequent Phonescreen round for a Software Engineer L4 position. The OA presented two challenging algorithmic problems: one involving dynamic programming with modular arithmetic and the other a tree-based problem requiring subtree sum calculations. The Phonescreen round then focused on an interesting design problem related to playlist shuffling to minimize adjacent artists. I was able to approach all problems and provide solutions.

Interview Questions (3)

Q1
Count Ways to Select K Coins with Sum Divisible by M
Data Structures & AlgorithmsHard

There are N coins valued (0 to N - 1). Calculate no. of ways to select K coins such that their sum is divisible by M. Return answer modulo 1e9 + 7.

int solve(int N, int M, int K)

Input:
4 2 2
Output: 2

Constraints:
1 <= N, M, K <= 10^3

Q2
Min Town Sum Difference After Edge Deletion in Tree
Data Structures & AlgorithmsMedium

Given tree graph with N nodes/regions (1 to N) and (N - 1) bidirectional edges/roads. Each node/region (i + 1) has no. of towns denoted by towns[i]. Calculate min difference in total sum of towns between resulting components when you delete one edge.

int minTownsDiff(int N, vector& towns, vector<vector>& roads)

Input:
2
10 20
1 2
Output: 10

Constraints:
1 <= N <= 10^5
1 <= towns[i] <= 10^4

Q3
Shuffle Playlist to Minimize Adjacent Artists
Data Structures & AlgorithmsMedium

Given a playlist of songs. Implement a shuffle function, such that there is no/minimal adjacent artists.

using Song = pair<string, string>; // (artist, song)
void shuffle(vector<Song>& playlist)

Input:
[ { "artist": "A", "song": "apple" }, { "artist": "A", "song": "banana" }, { "artist": "B", "song": "orange" }, { "artist": "B", "song": "guava" }, { "artist": "C", "song": "mango" } ]
Output: ABABC

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!