Google Placement Papers 2024
Access 2024 Google placement paper questions with solutions and exam pattern analysis.
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:
Google Placement Papers 2024
Access 2024 Google placement paper questions with solutions and exam pattern analysis.
Google Placement Papers 2025
Practice latest 2025 Google placement paper questions with updated patterns.
Complete Google guide
Access complete Google placement papers guide with eligibility, process, and preparation strategy.
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] = iExample: “()[]” → 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 stackExample: [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 = nextdef 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.nextExample: [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_profitExample: [1,2,3,1] → true, [1,2,3,4] → false
def containsDuplicate(nums): return len(nums) != len(set(nums))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 = nextdef reverseList(head): prev = None curr = head while curr: next_temp = curr.next curr.next = prev prev = curr curr = next_temp return prevExample: (2→4→3) + (5→6→4) = (7→0→8) Represents: 342 + 465 = 807
class ListNode: def __init__(self, val=0, next=None): self.val = val self.next = nextdef addTwoNumbers(l1, l2): dummy = ListNode() curr = dummy carry = 0 while l1 or l2 or carry: v1 = l1.val if l1 else 0 v2 = l2.val if l2 else 0 val = v1 + v2 + carry carry = val // 10 curr.next = ListNode(val % 10) curr = curr.next l1 = l1.next if l1 else None l2 = l2.next if l2 else None return dummy.nextExample: “abcabcbb” → 3 (substring “abc”)
def lengthOfLongestSubstring(s): seen = {} left = 0 max_len = 0 for right, char in enumerate(s): if char in seen and seen[char] >= left: left = seen[char] + 1 seen[char] = right max_len = max(max_len, right - left + 1) return max_lenExample: [3,9,20,null,null,15,7] → [[3],[9,20],[15,7]]
from collections import dequeclass TreeNode: def __init__(self, val=0, left=None, right=None): self.val = val self.left = left self.right = rightdef levelOrder(root): if not root: return [] result, queue = [], deque([root]) while queue: level = [] for _ in range(len(queue)): node = queue.popleft() level.append(node.val) if node.left: queue.append(node.left) if node.right: queue.append(node.right) result.append(level) return resultExample: “babad” → “bab” or “aba”
def longestPalindrome(s): def expand(left, right): while left >= 0 and right < len(s) and s[left] == s[right]: left -= 1 right += 1 return s[left+1:right] result = "" for i in range(len(s)): odd = expand(i, i) even = expand(i, i+1) result = max(result, odd, even, key=len) return resultExample: [1,8,6,2,5,4,8,3,7] → 49
def maxArea(height): left, right = 0, len(height) - 1 max_area = 0 while left < right: area = min(height[left], height[right]) * (right - left) max_area = max(max_area, area) if height[left] < height[right]: left += 1 else: right -= 1 return max_areaExample: [-1,0,1,2,-1,-4] → [[-1,-1,2],[-1,0,1]]
def threeSum(nums): nums.sort() result = [] for i in range(len(nums)-2): if i > 0 and nums[i] == nums[i-1]: continue left, right = i+1, len(nums)-1 while left < right: s = nums[i] + nums[left] + nums[right] if s < 0: left += 1 elif s > 0: right -= 1 else: result.append([nums[i], nums[left], nums[right]]) while left < right and nums[left] == nums[left+1]: left += 1 while left < right and nums[right] == nums[right-1]: right -= 1 left += 1 right -= 1 return resultExample: [1,2,3,4] → [24,12,8,6]
def productExceptSelf(nums): n = len(nums) result = [1] * n prefix = 1 for i in range(n): result[i] = prefix prefix *= nums[i] suffix = 1 for i in range(n-1, -1, -1): result[i] *= suffix suffix *= nums[i] return resultExample: [1,3], [2] → 2.0
def findMedianSortedArrays(nums1, nums2): A, B = nums1, nums2 m, n = len(A), len(B) if m > n: A, B, m, n = B, A, n, m imin, imax, half = 0, m, (m + n + 1) // 2 while imin <= imax: i = (imin + imax) // 2 j = half - i if i < m and B[j-1] > A[i]: imin = i + 1 elif i > 0 and A[i-1] > B[j]: imax = i - 1 else: if i == 0: max_of_left = B[j-1] elif j == 0: max_of_left = A[i-1] else: max_of_left = max(A[i-1], B[j-1]) if (m + n) % 2 == 1: return max_of_left if i == m: min_of_right = B[j] elif j == n: min_of_right = A[i] else: min_of_right = min(A[i], B[j]) return (max_of_left + min_of_right) / 2.0class Codec: def serialize(self, root): vals = [] def dfs(node): if not node: vals.append('#') return vals.append(str(node.val)) dfs(node.left) dfs(node.right) dfs(root) return ' '.join(vals) def deserialize(self, data): vals = iter(data.split()) def dfs(): val = next(vals) if val == '#': return None node = TreeNode(int(val)) node.left = dfs() node.right = dfs() return node return dfs()def minDistance(word1, word2): m, n = len(word1), len(word2) dp = [[0]*(n+1) for _ in range(m+1)] for i in range(m+1): for j in range(n+1): if i == 0: dp[i][j] = j elif j == 0: dp[i][j] = i elif word1[i-1] == word2[j-1]: dp[i][j] = dp[i-1][j-1] else: dp[i][j] = 1 + min(dp[i-1][j], dp[i][j-1], dp[i-1][j-1]) return dp[m][n]from collections import OrderedDictclass LRUCache: def __init__(self, capacity): self.cache = OrderedDict() self.capacity = capacity def get(self, key): if key not in self.cache: return -1 self.cache.move_to_end(key) return self.cache[key] def put(self, key, value): if key in self.cache: self.cache.move_to_end(key) self.cache[key] = value if len(self.cache) > self.capacity: self.cache.popitem(last=False)Example: [0,1,0,2,1,0,1,3,2,1,2,1] → 6
def trap(height): if not height: return 0 left, right = 0, len(height) - 1 left_max, right_max = height[left], height[right] water = 0 while left < right: if left_max < right_max: left += 1 left_max = max(left_max, height[left]) water += left_max - height[left] else: right -= 1 right_max = max(right_max, height[right]) water += right_max - height[right] return waterfrom collections import dequedef ladderLength(beginWord, endWord, wordList): wordSet = set(wordList) if endWord not in wordSet: return 0 queue = deque([(beginWord, 1)]) visited = {beginWord} while queue: word, length = queue.popleft() if word == endWord: return length for i in range(len(word)): for c in 'abcdefghijklmnopqrstuvwxyz': new_word = word[:i] + c + word[i+1:] if new_word in wordSet and new_word not in visited: visited.add(new_word) queue.append((new_word, length + 1)) return 0import heapqclass ListNode: def __init__(self, val=0, next=None): self.val = val self.next = nextdef mergeKLists(lists): heap = [] for i, node in enumerate(lists): if node: heapq.heappush(heap, (node.val, i, node)) dummy = ListNode() curr = dummy while heap: val, idx, node = heapq.heappop(heap) curr.next = node curr = curr.next if node.next: heapq.heappush(heap, (node.next.val, idx, node.next)) return dummy.nextExample: “(()” → 2, “)()())” → 4
def longestValidParentheses(s): stack = [-1] max_len = 0 for i, char in enumerate(s): if char == '(': stack.append(i) else: stack.pop() if not stack: stack.append(i) else: max_len = max(max_len, i - stack[-1]) return max_lenShorten 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
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
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
Index billions of web pages
Return relevant results in less than 100ms
Handle 1 billion queries per day
Approach:
Web crawler for indexing
Inverted index for fast lookups
Ranking algorithm (PageRank, relevance)
Distributed storage and processing
Caching for popular queries
Real-time messaging
Support 100 million users
Message delivery guarantees
Group chats and 1-on-1 chats
Approach:
WebSocket connections for real-time
Message queue (Kafka) for reliability
Database for message history
Load balancer for WebSocket connections
Push notifications for offline users
Collect logs from millions of services
Store logs for 30 days
Support real-time log search
Handle 1 TB logs per day
Approach:
Log aggregation service
Distributed storage (HDFS, S3)
Indexing for fast search (Elasticsearch)
Stream processing for real-time analysis