Leave your Email to get the latest Google interview questions weekly. No spam we promise.
Google Online Assessment 2019
Fill 2D Array
...
Given a String, find the minimum number of deletions required to convert it into a palindrome.
Given an integer n, return the representations in Fibonacci base for the integer from 1 to n.
Given an int n, return all possible representations of n in Fibonacci base.
A pizza shop offers n pizzas along with m toppings. A customer plans to spend around x coins. The customer should order exactly one pizza, and may order zero, one or two toppings. Each topping may be ordered only once.
Given the lists of prices of available pizzas and toppings, what is the price closest to x of possible orders? Here, a price said closer to x when the difference from x is the smaller. Note the customer is allowed to make an order that costs more than x.
Given a binary grid where 0 represents water and 1 represents land. An island is surrounded by water and is formed by connecting adjacent lands horizontally or vertically. Delete all islands except their borders. A border is land adjacent to water. You may assume all four edges of the grid are surrounded by water
Normal palindrome is defined as a string that reads the same backwards as forwards, for example "abccba".
Given an input string representing one word, write a method that returns the start and end indices of all extensions in the word.
Given an integer N which represents number of edges, where bases are always 2.Find how many trapezoid you can create with the integer N?
Given an array return an integer indicating the minimum number of swap operations required to sort the array into ascending order.
Given a run-length encoded string s and a width of a board. Assume that the board is filled from left to right such that each line has exactly width chars. Return the run-length encoded string that represents the board rows from right to left without constructing the board.
Given 2 run-length encoded strings s and t. Determine if they represent the same string.
There are n students [0, ..., n-1] participate in a marathon. You are given an int array standings where standings[i] = j means that student j finished just before student i. Return the students in the order in which they finished the marathon.
Given an encoded string str, return true if and only if this string contains the specified secret word.
Given 2 strings pin and guess. Write a function to provide a hint that indicates how digits in guess match the pin.
Given two strings s and t, determine if you can convert s into t.
In a 2d array of integer, 2 denotes wall, 1 denotes zombie and 0 denotes human.
Google Interview Questions 2019
Version Snapshot,
Tree Game,
Find and Remove Redundant Edge in Binary Tree,
Assign Bicycles to the Closest Rider,
...
Google Robot in Maze Problem
1.1 Count Number of Ways in Matrix
1.2 Count Number of Ways with Obstacles in Matrix
1.3 Count Number of Ways Detour for North
Build Google Calculator For all Search Inputs
Count of Smaller Numbers
Closest Blocks
...
Tree Game
Two people in a game, player scores by claiming nodes in binary tree, tree node class as shown above.
The player who eventually owns more nodes wins the game.
Player A and B each claims a node at first.
After the first round, a player will only be able to claim a node adjacent to any node owned by himself.
A tree node is adjacent to its parent, left right and right child.
A node owned cannot be re-claimed.
End game when all nodes are owned.
If player A gets the first claim at node N, find whether it is possible for player B to win.
If yes, find out which node player B should claim at his first move.
Given the left view and front view of the skyline of a block as two arrays, find the maximum total height of buildings in the block.
Build a text editor class with the following functions,
moveCursorLeft(),
moveCursorRight(),
insertCharacter(char) //insert the char right before cursor
backspace() //delete the char right before cursor
Google On-site 2018 Winter
There are orbs on an NxM board ('O' denotes orb. 'X' denotes empty slot).
Whenever two orbs are in the same column or the same row, you get to erase one of them.
Try to erase as many orbs as possible.
Find the minimum number of orbs remained on board eventually.
Given a tree with n nodes. Each node has k coins, where 0 <= k <= n . There are total n coins on the tree. The goal is to move the coins such that each node has exactly one coin. What's the minimum moves required?Each move can only move one coin to an adjacent node.
Given the length and width of a matrix, get the number of paths from bottom-left to bottom right.
Give an array A of n integers where 1 <= a[i] <= K. Find out the length of the shortest sequence that can be constructed out of numbers 1, 2, .. k that is NOT a subsequence of A.
Given two two integer arrays, find the longest common subsequence.
eg: a =[1 5 2 6 3 7], b = [5 6 7 1 2 3]. return [1 2 3] or [5 6 7]
Implement an iterator to flatten a 2d vector.
Given a string, find the length of the longest substring T that contains at most k distinct characters. For example, Given s = “eceba” and k = 2, T is "ece" which its length is 3.
LeetCode Easy
Letter Combinations of a Phone Number
Valid Parentheses
Generate Parentheses
Next Permutation
Pow(x, n)
Spiral Matrix
Merge Intervals
Clone Graph
Word Break
Min Stack
Find Peak Element
Missing Ranges
Fraction to Recurring Decimal
Binary Search Tree Iterator
Number of Islands
Implement Trie (Prefix Tree)
Summary Ranges
Kth Smallest Element in a BST
Power of Two
Search a 2D Matrix II
Strobogrammatic Number
Strobogrammatic Number II
Group Shifted Strings
Flatten 2D Vector
Meeting Rooms II
Binary Tree Paths
3Sum Smaller
Graph Valid Tree
Palindrome Permutation
Closest Binary Search Tree Value
Encode and Decode Strings
H-Index
Paint Fence
Perfect Squares
Wiggle Sort
Zigzag Iterator
Peeking Iterator
Walls and Gates
Unique Word Abbreviation
Game of Life
Flip Game
Flip Game II
Binary Tree Longest Consecutive Sequence
Best Time to Buy and Sell Stock with Cooldown
Minimum Height Trees
Super Ugly Number
Binary Tree Vertical Order Traversal
Maximum Product of Word Lengths
Generalized Abbreviation
Number of Connected Components in an Undirected Graph
Wiggle Sort II
Power of Three
Verify Preorder Serialization of a Binary Tree
Reconstruct Itinerary
Flatten Nested List Iterator
Reverse Vowels of a String
Moving Average from Data Stream
Design Tic-Tac-Toe
Android Unlock Patterns
Design Snake Game
Line Reflection
Count Numbers with Unique Digits
Logger Rate Limiter
Sort Transformed Array
Bomb Enemy
Design Hit Counter
Max Sum of Rectangle No Larger Than K
Largest Divisible Subset
Plus One Linked List
Range Addition
Find K Pairs with Smallest Sums
Guess Number Higher or Lower
Guess Number Higher or Lower II
Combination Sum IV
Kth Smallest Element in a Sorted Matrix
Design Phone Directory
Insert Delete GetRandom O(1)
Linked List Random Node
Longest Absolute File Path
Find the Difference
UTF-8 Validation
Decode String
Integer Replacement
Evaluate Division
Nth Digit
Binary Watch
Remove K Digits
Queue Reconstruction by Height
Valid Word Abbreviation
Longest Palindrome
Add Strings
Pacific Atlantic Water Flow
Sentence Screen Fitting
Maximum XOR of Two Numbers in an Array
Valid Word Square
Sequence Reconstruction
Number of Boomerangs
Find All Numbers Disappeared in an Array
Sort Characters By Frequency
Repeated Substring Pattern
Island Perimeter
Convex Polygon
Encode String with Shortest Length
Ones and Zeroes
Heaters
Magical String
License Key Formatting
Max Consecutive Ones
Predict the Winner
Max Consecutive Ones II
The Maze
Diagonal Traverse
Find Mode in Binary Search Tree
Next Greater Element II
The Maze II
Relative Ranks
Longest Uncommon Subsequence I
Longest Uncommon Subsequence II
Longest Word in Dictionary through Deleting
Beautiful Arrangement
Lonely Pixel I
Lonely Pixel II
Encode and Decode TinyURL
Reverse String II
01 Matrix
Diameter of Binary Tree
Output Contest Matches
Boundary of Binary Tree
Binary Tree Longest Consecutive Sequence II
Student Attendance Record I
Longest Line of Consecutive One in Matrix
Delete Operation for Two Strings
Add Bold Tag in String
Shopping Offers
Maximum Average Subarray I
Find Duplicate Subtrees
Find K Closest Elements
Split Array into Consecutive Subsequences
Non-decreasing Array
Beautiful Arrangement II
Repeated String Match
My Calendar II
Sentence Similarity II
Daily Temperatures
First Unique Character in a String
Shortest Completing Word
Largest Number At Least Twice of Others
Bold Words in String
Find Anagram Mappings
Rotated Digits
Escape The Ghosts
Domino and Tromino Tiling
Number of Matching Subsequences
Find Eventual Safe States
Soup Servings
Expressive Words
Largest Triangle Area
Largest Sum of Averages
Ambiguous Coordinates
Positions of Large Groups
Flipping an Image
Find And Replace in String
New 21 Game
Push Dominoes
Magic Squares In Grid
Keys and Rooms
Backspace String Compare
Maximize Distance to Closest Person
Peak Index in a Mountain Array
Exam Room
LeetCode Hard
Median of Two Sorted Arrays
Regular Expression Matching
Merge k Sorted Lists
Trapping Rain Water
Wildcard Matching
Insert Interval
Longest Consecutive Sequence
Longest Substring with At Most Two Distinct Characters
LRU Cache
Word Break II
Word Search II
Shortest Palindrome
The Skyline Problem
Basic Calculator
Sliding Window Maximum
Alien Dictionary
Closest Binary Search Tree Value II
Expression Add Operators
Find Median from Data Stream
Serialize and Deserialize Binary Tree
Smallest Rectangle Enclosing Black Pixels
Number of Islands II
Range Sum Query 2D - Mutable
Count of Smaller Numbers After Self
Number of Atoms
My Calendar III
Cracking the Safe
Couples Holding Hands
Max Chunks To Make Sorted II
Minimize Max Distance to Gas Station
Swim in Rising Water
Transform to Chessboard
Reaching Points
Bricks Falling When Hit
Bus Routes
Race Car
Sum of Distances in Tree
Similar String Groups
Guess the Word
K-Similar Strings
Shortest Path Visiting All Nodes
Minimum Window Subsequence
Remove Duplicate Letters
Shortest Distance from All Buildings
Burst Balloons
Create Maximum Number
Count of Range Sum
Longest Increasing Path in a Matrix
Patching Array
Palindrome Pairs
Longest Substring with At Most K Distinct Characters
Word Squares
Russian Doll Envelopes
Rearrange String k Distance Apart
Perfect Rectangle
Trapping Rain Water II
Minimum Unique Word Abbreviation
LFU Cache
Optimal Account Balancing
Sliding Window Median
Smallest Good Base
Reverse Pairs
Freedom Trail
Word Abbreviation
Student Attendance Record II
Maximum Vacation Days
Median Employee Salary
Erect the Fence
Maximum Average Subarray II
Coin Path
Kth Smallest Number in Multiplication Table
24 Game
K Empty Slots
Redundant Connection II
Maximum Sum of 3 Non-Overlapping Subarrays