Google logo

Google Frontend Engineer Interview Questions

48 practice questions for Google Frontend Engineer interviews

Google frontend engineer interviews emphasise JavaScript, DOM manipulation, CSS, accessibility, browser APIs, and UI component architecture.

All Roles Software Engineer Backend Engineer Frontend Engineer Full Stack Engineer Mobile Engineer Data Engineer Data Scientist ML Engineer DevOps Engineer DevOps Engineer Product Manager SRE Security Engineer Engineering Manager Data Analyst UX/UI Designer QA Engineer
coding Medium Verified Question #1

1. Dictionary of Sorted Letters


Category: Array coding problem
# Question Given a string where letters are sorted in alphabetical order, identify all letters that appear more than twice and record their first and...
Input: Array
Output: Computed result
coding Medium Verified Question #2

2. GPS Error Tracking


Category: Algorithm coding problem
# Question You are tracking GPS location errors by comparing measured GPS locations against a set of "golden" (reference) locations. Each location...
Input: List
Output: Computed result
coding Hard Verified Question #3

3. Minimum Boxing Area


Category: Binary search coding problem
# Question Design a data structure to maintain a dynamic set of points on a 2D coordinate plane. Support operations to insert points, remove points,...
Input: List
Output: Integer
coding Medium Verified Question #4

4. Reverse Segment of Linked List


Category: Linked list coding problem
# Question Given a singly linked list, reverse the second half of the list and then interleave the nodes from the first half and the reversed second...
Input: Linked list
Output: Computed result
coding Medium Verified Question #5

5. Unpainted Segments


Category: Binary search coding problem
# Question You are given a range [A, B] and a sequence of painting operations. For each operation [L, R], calculate the total length of unpainted...
Input: Array of intervals
Output: Computed result
coding Medium Verified Question #6

6. Running Tests With Failing Pairs


Category: Algorithm coding problem
# Question You are given a set of test cases and a black-box function runTests() that accepts a subset of these test cases and returns whether...
Input: List
Output: Integer
coding Medium Verified Question #7

7. Connected Crop Allocation


Category: Grid/matrix coding problem
# Question You are given an M x N garden grid and a list of crops, each requiring a specific number of plots. The total number of plots required by...
Input: 2D grid
Output: Computed result
coding Medium Verified Question #8

8. [CodeSignal] Maximum Zero-Sum Triplets


Category: Array coding problem
# Question You are given an array A of integers. A triplet is a sequence of three consecutive elements. A triplet is called zero-sum if the...
Input: Array
Output: Computed result
coding Easy Verified Question #9

9. [CodeSignal] Coin Table Game


Category: String coding problem
# Question A player is playing a game in which coins are placed on and removed from a table. The game consists of multiple rounds. At the beginning...
Input: String
Output: Computed result
coding Medium Verified Question #10

10. Longest Match Tokenizer


Category: Array coding problem
You are given a text string text and a dictionary array where each element is in the format "<key>:<id>". Here key is a token string and id...
Input: Array
Output: Computed result
coding Hard Verified Question #11

11. Dual Extremes Queue


Category: Queue-based coding problem
Design a StreamBuffer class that buffers a stream of integer latency samples in FIFO order and supports O(1) access to both the minimum and maximum...
Input: Integer(s)
Output: Integer
coding Medium Verified Question #12

12. Daily Branch Pruning


Category: Tree coding problem
A file system manages a directory tree. Each day, all leaf directories (those with no child directories) are simultaneously removed. Directories that...
Input: Array
Output: Array
coding Medium Verified Question #13

13. Path Router


Category: Algorithm coding problem
# Question Design a PathRouter class that maps URL-like path patterns to handler names. Patterns may contain wildcard segments (*) that match any...
Input: Number(s)
Output: Computed result
coding Medium Verified Question #14

14. Frequency Merge Tree


Category: Tree coding problem
# Question Given a string, build a Frequency Merge Tree as follows: 1. Count the frequency of each character in the string. 2. Create a leaf node...
Input: String
Output: Computed result
coding Hard Verified Question #15

15. Expression Simplifier


Category: String coding problem
Given an algebraic expression string containing single lowercase-letter variables, the operators + and -, and parentheses ( and ), simplify...
Input: String
Output: Computed result
coding Medium Verified Question #16

16. Largest Island Perimeter


Category: Grid/matrix coding problem
You are given an m x n binary grid where each cell is either '1' (land) or '0' (water). A group of connected land cells (connected horizontally...
Input: 2D grid
Output: Computed result
coding Hard Verified Question #17

17. Interval Coverage Counter


Category: Interval-based coding problem
Given a list of closed intervals on the integer number line, build a data structure that efficiently answers point-coverage queries. A closed...
Input: List
Output: Computed result
coding Hard two pointers #1

1. [OA] Two Pointers — Optimize the Google Photos Sharing Algorithm

In Google Photos, users can share albums with friends and family. You are tasked with optimizing the album sharing process to ensure maximum unique views within a minimum number of clicks.
Problem Statement: Given two sorted arrays views1 and views2 representing the number of times two different albums have been viewed, implement a function maxUniqueViews(views1: number[], views2: number[]): number to return the maximum unique views a user can get by sharing the albums from both lists.
- Example 1:
Input: views1 = [1, 3, 5], views2 = [2, 4, 6]
Output: 6
Explanation: All views are unique, hence 1 + 2 + 3. The unique views = 1, 3, 2, 4, 5, 6.
- Example 2:
Input: views1 = [1, 2, 3], views2 = [3, 4, 5]
Output: 5
Explanation: The common view 3 counts only once. The unique views = 1, 2, 4, 5.
Constraints:
- 1 <= views1.length, views2.length <= 10^5
- 1 <= views1[i], views2[j] <= 10^9
coding Hard sliding window #2

2. [OA] Sliding Window — Optimize the Ads Rotation for Google Ads

Google Ads requires an efficient method to determine the maximum exposure of ads based on a given window of time. You need to calculate the maximum number of ads that can be displayed within a specified duration while ensuring a minimum time gap between the same ads.
Problem Statement: Given an integer array ads representing the timestamps of ads being displayed, and an integer minGap representing the minimum time gap required between the same ad displays, write a function maxAdsDisplayed(ads: number[], minGap: number): number that returns the maximum number of ads that can be displayed following this rule.
- Example 1:
Input: ads = [1, 2, 3, 4, 5, 6], minGap = 2
Output: 4
Explanation: Ads can be displayed at timestamps 1, 3, 5 and 6, skipping timestamps 2 and 4 to respect the gap.
- Example 2:
Input: ads = [1, 1, 1, 3, 5], minGap = 2
Output: 3
Explanation: Ads can be displayed at timestamps 1 (first), 3 and 5, respecting the minimum gap of 2.
Constraints:
- 1 <= ads.length <= 10^5
- 1 <= ads[i] <= 10^9
- 1 <= minGap <= 10^6
system design Senior api design #3

3. [OA] Client-Side Router — Design a Router for Google Maps

Google Maps needs an efficient way to handle client-side routing for various map views. Your task is to design a class-based router that can manage routes based on the current path and dynamically load components.
Problem Statement: Implement a class Router that manages routes for a map application and has the following methods:
- addRoute(path: string, component: any): void: Adds a new route mapping path to a component.
- navigate(path: string): void: Navigates to the specified path and loads the associated component.
- getCurrentComponent(): any: Returns the component of the current route.
Example 1:
const router = new Router();
router.addRoute('/home', HomeComponent);
router.addRoute('/about', AboutComponent);
router.navigate('/home');
console.log(router.getCurrentComponent()); // HomeComponent example
Constraints:
- The path will always be a string in the format of /[a-zA-Z]+.
- The component can be any function or class that should be rendered for that route.
system design Senior caching #4

4. [OA] LRU Cache — Implement a caching layer for Google Search Results

As part of Google Search Services, you need to optimize data retrieval by implementing an LRU (Least Recently Used) Cache. This cache will store recently accessed search queries and their results, helping to reduce the load on Google's servers and speed up user interactions.
Problem Statement: Design and implement a data structure for an LRU Cache that supports the following operations:
- get(key: number): number: Retrieves the value of the key if the key exists in the cache. Otherwise, returns -1.
- put(key: number, value: number): void: Updates the value of the key if the key exists. If the key does not exist, add the key-value pair to the cache. If the cache reaches its capacity, it should invalidate the least recently used item before inserting the new item.
Example 1:
LRUCache cache = new LRUCache(2);
cache.put(1, 1);
cache.put(2, 2);
cache.get(1); // returns 1
cache.put(3, 3); // evicts key 2
cache.get(2); // returns -1 (not found)
Constraints:
- capacity of the cache is between 1 and 3000.
- All keys and values are positive integers.

Related Google Frontend Engineer interview prep

Start practicing Google questions

Sign up for free to access walkthroughs, AI-generated questions, and more.

Get Started Free