Skip to content

Google Coding Questions

Practice with 30+ Google placement paper coding questions covering DSA problems, system design concepts, and technical fundamentals. These questions are representative of what you’ll encounter in Google’s online assessment and technical interviews.

What’s Included:

  • 24 Coding Problems: Easy, Medium, and Hard level questions with Python solutions
  • 6 System Design Questions: Basic and advanced system design problems
  • Detailed Solutions: Step-by-step code explanations and time complexity analysis
  • Practice Tips: Strategies for solving Google interview questions effectively

Coding problems

Two Sum Given array of integers and target, return indices of two numbers that add up to target.

Example: [2,7,11,15], target=9 → [0,1]

def twoSum(nums, target):
lookup = {}
for i, num in enumerate(nums):
if target - num in lookup:
return [lookup[target - num], i]
lookup[num] = i

Valid Parentheses Check if string with brackets is valid.

Example: “()[]” → true, “([)]” → false

def isValid(s):
stack = []
mapping = {')': '(', '}': '{', ']': '['}
for char in s:
if char in mapping.values():
stack.append(char)
elif char in mapping:
if not stack or stack.pop() != mapping[char]:
return False
else:
return False
return not stack

Merge Two Sorted Lists Merge two sorted linked lists.

Example: [1,2,4] + [1,3,4] → [1,1,2,3,4,4]

class ListNode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
def mergeTwoLists(l1, l2):
dummy = ListNode()
curr = dummy
while l1 and l2:
if l1.val < l2.val:
curr.next = l1
l1 = l1.next
else:
curr.next = l2
l2 = l2.next
curr = curr.next
curr.next = l1 or l2
return dummy.next

Best Time to Buy and Sell Stock Find maximum profit from buying and selling stock once.

Example: [7,1,5,3,6,4] → 5 (buy at 1, sell at 6)

def maxProfit(prices):
min_price = float('inf')
max_profit = 0
for price in prices:
min_price = min(min_price, price)
max_profit = max(max_profit, price - min_price)
return max_profit

Contains Duplicate Check if array contains any duplicates.

Example: [1,2,3,1] → true, [1,2,3,4] → false

def containsDuplicate(nums):
return len(nums) != len(set(nums))

Reverse Linked List Reverse a singly linked list.

Example: 1→2→3→4→5 → 5→4→3→2→1

class ListNode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
def reverseList(head):
prev = None
curr = head
while curr:
next_temp = curr.next
curr.next = prev
prev = curr
curr = next_temp
return prev

System Design questions

Design a URL Shortener (like bit.ly) Requirements:

  • Shorten long URLs to 6-8 character codes

  • Redirect short URLs to original URLs

  • Handle 100 million URLs per day

    Approach:

  • Use base62 encoding for short codes

  • Database: Store mapping of short code → long URL

  • Cache: Use Redis for frequently accessed URLs

  • Load balancer: Distribute traffic across servers

  • Database sharding: Partition by hash of short code

  • Design a Distributed Cache Requirements:

  • Store key-value pairs in memory

  • Support TTL (time-to-live) for cache entries

  • Handle cache eviction (LRU policy)

  • Scale to multiple servers

    Approach:

  • Use consistent hashing for key distribution

  • Implement LRU eviction per server

  • Replication for high availability

  • Cache invalidation strategies

  • Design a Rate Limiter Requirements:

  • Limit API requests per user/IP

  • Support sliding window algorithm

  • Handle 1 million requests per second

    Approach:

  • Token bucket or sliding window algorithm

  • Use Redis for distributed rate limiting

  • Store counters with TTL

  • Load balancer integration

Practice More Google Interview Questions →

Comments & Suggestions

Similar companies

Amazon · Microsoft · Meta · Apple · Netflix · LinkedIn