Google coding interviews primarily assess a candidate's problem-solving ability, coding proficiency, and understanding of core computer science concepts. Most coding rounds focus on solving optimized Data Structures and Algorithms (DSA) problems while writing clean, efficient code and explaining the logic, time complexity, and space complexity.
- Focus Areas: Arrays, Strings, Linked Lists, Stacks, Queues, Trees, Binary Search Trees (BST), Graphs, Heaps, Hashing, Recursion, Backtracking, Dynamic Programming (DP), Greedy Algorithms, Searching & Sorting, and Bit Manipulation.
- Interview Expectation: Write optimized and readable code, justify your approach with complexity analysis, handle edge cases, and communicate your thought process clearly throughout the interview.
Array
An Array is a collection of items stored at contiguous memory locations. The idea is to store multiple items of the same type together. Practice Problem
- Wave array [Practice Problem]
- Subarray with given sum [Practice Problem]
- Majority element [Practice Problem]
- Peak element [Practice Problem]
- Three sum closest [Practice Problem]
- Number of subarrays having sum exactly equal to k [Practice Problem]
- Kadane's Algorithm [Practice Problem]
- Find the element that appears once [Practice Problem]
- Find the minimum element in a sorted and rotated array [Practice Problem]
- Search a word in a 2d grid of characters [Practice Problem]
- Find surpasser count of each element in array [Practice Problem]
- Smallest absolute difference [Practice Problem]
- Sum of bit differences among all pairs [Practice Problem]
- Count more than n/k occurrences [Practice Problem]
- Capacity to ship packages within d days [Practice Problem]
- Stock buy and sell - multiple transaction allowed [Practice Problem]
- Maximum product subarray [Practice Problem]
- Rearrange array elements by sign [Practice Problem]
- Minimum swaps required to group all 1's together [Practice Problem]
String
Strings are defined as an array of characters. The difference between a character array and a string is the string is terminated with a special character ‘\0’.
- Valid Expression [Practice Problem]
- Multiply large numbers represented as strings [Practice Problem]
- Minimum indexed character [Practice Problem]
- Find maximum number possible by doing at-most k swaps [Practice Problem]
- Uncommon characters [Practice Problem]
- License key formatting [Practice Problem]
- Minimum insertions to form a palindrome [Practice Problem]
- Longest Repeating Subsequence [Practice Problem]
- Alien Dictionary [Practice Problem]
- Anagram Palindrome [Practice Problem]
- Longest Palindromic Substring [Practice Problem]
- Rabin-Karp algorithm for pattern searching [Practice Problem]
- Longest prefix which is also suffix [Practice Problem]
- Isomorphic Strings Check [Practice Problem]
- Smallest window in a string containing all characters of other string [Practice Problem]
- Longest Substring Without Repeating Characters [Practice Problem]
Linked List
A Linked List is a linear data structure, in which the elements are not stored at contiguous memory locations.
- Nth node from end of linked list [Practice Problem]
- Reverse a linked list [Practice Problem]
- Detect loop in a linked list [Practice Problem]
- Delete a node from linked list without head pointer [Practice Problem]
- Find length of loop [Practice Problem]
- Insert in a sorted list [Practice Problem]
- Pairwise swap nodes of a given linked list [Practice Problem]
- Sort a linked list of 0s, 1s and 2s [Practice Problem]
- Reverse a sublist of a linked list [Practice Problem]
- Reverse a doubly linked list [Practice Problem]
- Swap k-th nodes in linked list [Practice Problem]
Stack
A Stack is a linear data structure in which elements can be inserted and deleted only from one side of the list, called the top. A stack follows the LIFO (Last In First Out) principle.
- Delete middle element of a stack [Practice Problem]
- Stack Permutations [Practice Problem]
- Design a stack with operations on middle element [Practice Problem]
- Infix to postfix expression [Practice Problem]
Queue
A Queue is a linear data structure where elements are inserted at the rear and removed from the front, following the FIFO (First In, First Out) principle.
- The Celebrity Problem [Practice Problem]
- Maximum rectangular area in a histogram [Practice Problem]
- Max rectangle [Practice Problem]
- Length of the longest valid substring [Practice Problem]
- Find the first circular tour that visits all petrol pumps [Practice Problem]
- LRU Cache Implementation [Practice Problem]
- Minimum time required to rot all oranges [Practice Problem]
- Sliding window maximum (maximum of all subarrays of size k) [Practice Problem]
Searching
Searching Algorithms are designed to check for an element or retrieve an element from any data structure where it is stored.
- Subarray with given sum [Practice Problem]
- Kth smallest element [Practice Problem]
- Find a peak element [Practice Problem]
- Search in a rotated array [Practice Problem]
- The Painter's Partition Problem-II [Practice Problem]
- Minimum number of times a has to be repeated such that b is a substring of it [Practice Problem]
- Koko Eating Bananas [Practice Problem]
- Next greater number set digits [Practice Problem]
- Median of 2 sorted arrays of different sizes [Practice Problem]
- Maximum no of 1's row [Practice Problem]
- Elements in the range [Practice Problem]
- Search in a row wise and column wise sorted matrix [Practice Problem]
- Minimize coin removal for bounded pile differences [Practice Problem]
Sorting
A Sorting Algorithms is used to rearrange a given array or list of elements according to a comparison operator on the elements. The comparison operator is used to decide the new order of elements in the respective data structure.
- Floor in a sorted array [Practice Problem]
- Find all triplets with zero sum [Practice Problem]
- Count Inversions [Practice Problem]
- Sort an array of 0s, 1s and 2s [Practice Problem]
- Minimum Platforms [Practice Problem]
- Count the number of possible triangles [Practice Problem]
- At least two greater elements [Practice Problem]
- Maximum Intervals Overlap [Practice Problem]
- Next Greater Even Number [Practice Problem]
- Count Smaller elements [Practice Problem]
- Chocolate Distribution Problem [Practice Problem]
- Sort elements by frequency using STL [Practice Problem]
- Merge Two Sorted Arrays Without Extra Space [Practice Problem]
Hash
Hashing is a technique or process of mapping keys, and values into the hash table by using a hash function. It is done for faster access to elements. The efficiency of mapping depends on the efficiency of the hash function used.
- Check if an array is subset of another array [Practice Problem]
- Count subarrays with given XOR [Practice Problem]
- Smallest range with elements from k sorted lists [Practice Problem]
Heap
A Heap is a special Tree-based data structure in which the tree is a complete binary tree. Heap and hash is an efficient implementation of a priority queue. The linear hash function monotonically maps keys to buckets, and each bucket is a heap.
- Count pairs with given sum [Practice Problem]
- Longest Consecutive Subsequence [Practice Problem]
- Triplet sum in array [Practice Problem]
- Largest subarray of 0's and 1's [Practice Problem]
- Find median in a stream [Practice Problem]
- Longest K unique characters substring [Practice Problem]
- Winner of an election [Practice Problem]
- Binary Heap Operations [Practice Problem]
- Kth element in matrix [Practice Problem ]
- Game With String [Practice Problem]
- Rearrange characters [Practice Problem]
- Maximize elements using another array [Practice Problem]
- Huffman Coding [Practice Problem]
Trees
A Tree is non-linear and a hierarchical data structure consisting of a collection of nodes such that each node of the tree stores a value, a list of references to nodes (the “children”) :
- Print leaf nodes from preorder traversal of BST [Practice Problem]
- Height of binary tree [Practice Problem]
- ZigZag Tree Traversal [Practice Problem]
- Left View of binary tree [Practice Problem]
- Boundary traversal of binary tree [Practice Problem]
- Lowest common ancestor in a binary tree [Practice Problem]
- Bottom view of binary tree [Practice Problem]
- Mirror Tree [Practice Problem]
- Sorted link list to BST [Practice Problem]
- k-th smallest element in BST [Practice Problem]
- Merge two BST 's [Practice Problem]
- Maximum path sum from any node [Practice Problem]
- Maximum sum of non-adjacent nodes [Practice Problem]
- Root to leaf paths sum [Practice Problem]
- Maximum Path Sum Between 2 Leaf Nodes [Practice Problem]
- Count BST nodes that lie in a given range [Practice Problem]
- Connect nodes at same level [Practice Problem]
- Balanced binary tree or not [Practice Problem]
- Difference between sums of odd level and even level nodes of a binary tree [Practice Problem]
Graph
A Graph is a non-linear data structure consisting of nodes and edges. The nodes are sometimes also referred to as vertices and the edges are lines or arcs that connect any two nodes in the graph.
- Dijkstra’s shortest path algorithm [Practice Problem]
- Find the number of islands [Practice Problem]
- Unit area of largest region of 1's [Practice Problem]
- Word Boggle [Practice Problem]
- Prerequisite Tasks [Practice Problem]
- Flood fill algorithm [Practice Problem]
- Number of provinces [Practice Problem]
- Word Ladder I [Practice Problem]
- Knight Walk [Practice Problem]
- Course Schedule [Practice Problem]
- Clone Graph [Practice Problem]
- Detect cycle in an undirected graph [Practice Problem]
- Kruskal’s Minimum Spanning Tree (MST) Algorithm [Practice Problem]
Dynamic Programming
Dynamic Programming is mainly an optimization over plain recursion. Wherever we see a recursive solution that has repeated calls for same inputs, we can optimize it using Dynamic Programming.
- Trapping Rain Water [Practice Problem]
- Maximum Product Subarray [Practice Problem]
- Stock buy and sell [Practice Problem]
- Interleaved Strings [Practice Problem]
- Stickler Thief [Practice Problem]
- Smallest window in a string containing all the characters of another string [Practice Problem]
- Max rectangle [Practice Problem]
- Activity Selection [Practice Problem]
- Jump Game [Practice Problem]
- Knapsack with duplicate items [Practice Problem]
- Wildcard Pattern Matching [Practice Problem]
- Total Decoding Messages [Practice Problem]
- Matrix Chain Multiplication [Practice Problem]
- Count occurrences of a given word in a 2-d array [Practice Problem]
- Brackets in matrix chain multiplication [Practice Problem]
- Burst balloon to maximize coins [Practice Problem]
- Shortest Common Supersequence [Practice Problem]
- Coin Change - Count Ways To Make Sum [Practice Problem]