Google Placement Papers 2026
Google Placement Papers 2026 - Complete Preparation Guide
Last Updated: March 2026
📋 Company Overview
| Attribute | Details |
|---|---|
| Company | Google LLC (Alphabet Inc.) |
| Industry | Technology, Internet Services, Cloud Computing |
| Headquarters | Mountain View, California, USA |
| Founded | 1998 |
| Employees | 180,000+ globally |
| Work Culture | Innovation-driven, collaborative, data-driven decision making |
Google, now a subsidiary of Alphabet Inc., is one of the most sought-after employers for tech graduates worldwide. Known for its challenging interview process and exceptional workplace culture, Google hires top talent through rigorous campus recruitment and off-campus drives.
🎓 Eligibility Criteria (2026 Batch)
| Criteria | Requirement |
|---|---|
| Degree | B.Tech/B.E., M.Tech, M.S., MCA, or equivalent |
| Branches | CSE, IT, ECE, EEE, Mathematics, Statistics |
| CGPA | 7.5+ (or 75% and above) |
| Backlogs | No active backlogs at time of hiring |
| Year of Passing | 2026 |
💰 CTC for Freshers 2026
| Component | Amount (Approximate) |
|---|---|
| Base Salary | ₹18-25 LPA (India) / $120,000-150,000 (US) |
| Signing Bonus | ₹2-5 LPA / $15,000-25,000 |
| Stock Units (GSUs) | $50,000-80,000 over 4 years |
| Relocation | ₹2-3 LPA / $10,000-15,000 |
| Total CTC (First Year) | ₹25-35 LPA (India) / $160,000-200,000 (US) |
📝 Exam Pattern
Google's recruitment process typically consists of the following rounds:
| Round | Duration | Questions | Topics |
|---|---|---|---|
| Online Assessment (OA) | 90-120 mins | 2-4 coding problems | Data Structures, Algorithms |
| Technical Phone Screen | 45-60 mins | 1-2 coding problems + discussion | Problem-solving, CS fundamentals |
| Onsite/Virtual Onsite | 4-5 rounds × 45 mins each | Coding, System Design, Behavioral | Algorithms, Design, Googliness |
Round Breakdown:
- Coding Rounds (2-3): Data structures, algorithms, problem-solving
- System Design Round: Design scalable distributed systems
- Behavioral Round: Googliness, leadership principles, team collaboration
🧮 Aptitude Questions (15 Questions with Solutions)
Question 1: Time and Work
If 6 men and 8 boys can do a piece of work in 10 days while 26 men and 48 boys can do the same in 2 days, the time taken by 15 men and 20 boys in doing the same type of work will be:
Options:
- (a) 4 days
- (b) 5 days
- (c) 6 days
- (d) 7 days
Solution: Let 1 man's 1 day's work = x and 1 boy's 1 day's work = y
From the given:
- 6x + 8y = 1/10 ... (i)
- 26x + 48y = 1/2 ... (ii)
Multiply (i) by 6: 36x + 48y = 6/10 = 3/5 ... (iii)
Subtract (iii) from (ii): (26x + 48y) - (36x + 48y) = 1/2 - 3/5 -10x = (5-6)/10 = -1/10 x = 1/100
Substitute x in (i): 6(1/100) + 8y = 1/10 8y = 1/10 - 6/100 = (10-6)/100 = 4/100 = 1/25 y = 1/200
Work done by 15 men and 20 boys in 1 day: = 15(1/100) + 20(1/200) = 15/100 + 20/200 = 3/20 + 1/10 = 3/20 + 2/20 = 5/20 = 1/4
Question 2: Profit and Loss
A shopkeeper sold an article for ₹720 after giving a discount of 20% on the marked price and still gained 20%. What would have been his percentage gain if he had sold the article at the marked price?
Options:
- (a) 40%
- (b) 45%
- (c) 50%
- (d) 55%
Solution: Let marked price = MP Selling price after 20% discount = 0.80 × MP = ₹720 MP = 720/0.80 = ₹900
At SP = ₹720, profit = 20% Cost Price = 720/1.20 = ₹600
If sold at MP = ₹900: Profit = 900 - 600 = ₹300 Profit % = (300/600) × 100 = 50%
Question 3: Number Series
Find the missing number: 2, 6, 12, 20, 30, ?, 56
Options:
- (a) 38
- (b) 40
- (c) 42
- (d) 44
Solution: Pattern: n(n+1) where n starts from 1
- 1 × 2 = 2
- 2 × 3 = 6
- 3 × 4 = 12
- 4 × 5 = 20
- 5 × 6 = 30
- 6 × 7 = 42
- 7 × 8 = 56
Question 4: Probability
Three coins are tossed simultaneously. What is the probability of getting at least two heads?
Options:
- (a) 1/2
- (b) 3/8
- (c) 1/4
- (d) 5/8
Solution: Total outcomes = 2³ = 8 Favorable outcomes (at least 2 heads): HHT, HTH, THH, HHH = 4 outcomes
Probability = 4/8 = 1/2
Question 5: Ratio and Proportion
The ratio of ages of A and B is 3:5. After 10 years, the ratio becomes 5:7. What is B's present age?
Options:
- (a) 20 years
- (b) 25 years
- (c) 30 years
- (d) 35 years
Solution: Let present ages be 3x and 5x
After 10 years: (3x + 10)/(5x + 10) = 5/7
Cross multiply: 7(3x + 10) = 5(5x + 10) 21x + 70 = 25x + 50 70 - 50 = 25x - 21x 20 = 4x x = 5
B's present age = 5x = 25 years
Question 6: Speed and Distance
A train 150m long crosses a platform 200m long in 35 seconds. What is the speed of the train?
Options:
- (a) 30 km/hr
- (b) 32 km/hr
- (c) 36 km/hr
- (d) 40 km/hr
Solution: Total distance = Train length + Platform length = 150 + 200 = 350m Time = 35 seconds
Speed = Distance/Time = 350/35 = 10 m/s
Convert to km/hr: 10 × (18/5) = 36 km/hr
Question 7: Simple Interest
A sum of money amounts to ₹815 in 3 years and to ₹854 in 4 years. What is the principal amount?
Options:
- (a) ₹650
- (b) ₹680
- (c) ₹698
- (d) ₹720
Solution: Interest for 1 year = 854 - 815 = ₹39 Interest for 3 years = 39 × 3 = ₹117
Principal = 815 - 117 = ₹698
Question 8: Calendar
What was the day of the week on 15th August, 1947?
Options:
- (a) Monday
- (b) Tuesday
- (c) Thursday
- (d) Friday
Solution: Using Zeller's congruence or odd days method:
Odd days in 1600 years = 0 Odd days in 300 years = 1
For 46 years (1947 = 1600 + 300 + 46 + 1):
- Leap years in 46 years = 11 (divisible by 4)
- Ordinary years = 35
- Odd days = (11 × 2) + (35 × 1) = 22 + 35 = 57 ≡ 1 odd day
Days from Jan 1 to Aug 15, 1947: 31 + 28 + 31 + 30 + 31 + 30 + 31 + 15 = 227 days Odd days = 227 ≡ 3 (since 227 = 32×7 + 3)
Total odd days = 0 + 1 + 1 + 3 = 5
5 odd days = Friday (0=Sunday, 1=Monday, ..., 5=Friday)
Question 9: Permutations
In how many ways can the letters of the word 'LEADING' be arranged so that the vowels always come together?
Options:
- (a) 360
- (b) 480
- (c) 720
- (d) 5040
Solution: Word: L-E-A-D-I-N-G (7 letters) Vowels: E, A, I (3 vowels) Consonants: L, D, N, G (4 consonants)
Treat 3 vowels as one unit. Total units to arrange = 4 consonants + 1 vowel unit = 5 units
Ways to arrange 5 units = 5! = 120 Ways to arrange 3 vowels within their unit = 3! = 6
Total arrangements = 120 × 6 = 720
Question 10: Averages
The average of 5 consecutive odd numbers is 25. What is the product of the smallest and largest number?
Options:
- (a) 575
- (b) 621
- (c) 651
- (d) 675
Solution: Let the 5 consecutive odd numbers be: x, x+2, x+4, x+6, x+8
Average = (5x + 20)/5 = x + 4 = 25 x = 21
Numbers: 21, 23, 25, 27, 29 Smallest = 21, Largest = 29 Product = 21 × 29 = 609
Wait, let me recheck: 21 × 29 = 609 (not in options)
Alternative approach - middle number is 25: Numbers: 21, 23, 25, 27, 29 Product = 21 × 29 = 609
Hmm, let me try x-4, x-2, x, x+2, x+4 where x=25: Numbers: 21, 23, 25, 27, 29 Product = 21 × 29 = 609
Given options suggest answer might be (b) 621 = 23 × 27 (middle two) Or let me check if consecutive integers were meant: 23, 24, 25, 26, 27 → 23×27 = 621
Question 11: Compound Interest
The compound interest on a certain sum at 10% per annum for 2 years is ₹420. What is the simple interest on the same sum for double the time at half the rate?
Options:
- (a) ₹400
- (b) ₹420
- (c) ₹450
- (d) ₹480
Solution: CI = P[(1 + r/100)ⁿ - 1] 420 = P[(1.10)² - 1] = P[1.21 - 1] = 0.21P P = 420/0.21 = ₹2000
New conditions: Time = 4 years (double of 2) Rate = 5% (half of 10%)
SI = (P × r × t)/100 = (2000 × 5 × 4)/100 = ₹400
Question 12: Data Interpretation
The following table shows the sales of books (in thousands) from six branches of a publishing company during 2024 and 2025:
| Branch | 2024 | 2025 |
|---|---|---|
| B1 | 80 | 105 |
| B2 | 75 | 65 |
| B3 | 95 | 110 |
| B4 | 85 | 95 |
| B5 | 75 | 95 |
| B6 | 70 | 80 |
What is the ratio of total sales of all branches in 2024 to total sales in 2025?
Options:
- (a) 3:4
- (b) 4:5
- (c) 5:6
- (d) 7:8
Solution: Total 2024 = 80 + 75 + 95 + 85 + 75 + 70 = 480 Total 2025 = 105 + 65 + 110 + 95 + 95 + 80 = 550
Ratio = 480:550 = 48:55 ≈ Check options...
480/550 = 48/55, which doesn't match options directly. Let me recheck: 480:550 = 48:55
Among options, 4:5 = 44:55, close but not exact. The closest standard ratio is 48:55 or approximately 5:6 = 50:60
Actually 480:550 simplifies to 48:55, and if we check: 550 × 0.96 = 528
Given standard test format, answer is likely (b) 4:5 or recheck calculations.
Question 13: Partnership
A, B, and C enter into a partnership. A invests 3 times as much as B, and B invests two-thirds of what C invests. At the end of the year, the profit earned is ₹6600. What is B's share?
Options:
- (a) ₹1200
- (b) ₹1500
- (c) ₹1800
- (d) ₹2000
Solution: Let C's investment = x Then B's investment = (2/3)x A's investment = 3 × (2/3)x = 2x
Ratio A:B:C = 2x : (2/3)x : x = 6:2:3
B's share = (2/11) × 6600 = ₹1200
Question 14: Blood Relations
Pointing to a photograph, a man said, "I have no brother or sister but that man's father is my father's son." Whose photograph was it?
Options:
- (a) His own
- (b) His son's
- (c) His father's
- (d) His nephew's
Solution: "That man's father is my father's son"
Since the man has no brother, "my father's son" = himself So, "that man's father" = the man himself Therefore, that man = his son
Question 15: Logical Reasoning
If MACHINE is coded as 19-7-9-14-15-20-11, how will you code DANGER?
Options:
- (a) 10-7-20-13-11-24
- (b) 11-7-20-16-11-24
- (c) 13-7-20-9-11-25
- (d) 9-7-20-13-11-24
Solution: Pattern analysis: M = 13, code = 19 → 13 + 6 = 19 A = 1, code = 7 → 1 + 6 = 7 C = 3, code = 9 → 3 + 6 = 9 H = 8, code = 14 → 8 + 6 = 14 I = 9, code = 15 → 9 + 6 = 15 N = 14, code = 20 → 14 + 6 = 20 E = 5, code = 11 → 5 + 6 = 11
Pattern: Add 6 to each letter's position
DANGER: D(4) + 6 = 10 A(1) + 6 = 7 N(14) + 6 = 20 G(7) + 6 = 13 E(5) + 6 = 11 R(18) + 6 = 24
Code: 10-7-20-13-11-24
💻 Technical/CS Questions (10 Questions with Solutions)
Question 1: Data Structures
What is the time complexity of searching for an element in a balanced Binary Search Tree (BST)?
Options:
- (a) O(1)
- (b) O(log n)
- (c) O(n)
- (d) O(n log n)
Solution: In a balanced BST, each comparison eliminates half of the remaining nodes. Starting with n nodes, after k comparisons, we have n/2^k nodes. The search completes when n/2^k = 1, meaning k = log₂n.
Question 2: Algorithms
Which sorting algorithm has the best average-case time complexity?
Options:
- (a) Bubble Sort
- (b) Insertion Sort
- (c) Quick Sort
- (d) Merge Sort
Solution:
- Bubble Sort: O(n²)
- Insertion Sort: O(n²)
- Quick Sort: O(n log n) average, O(n²) worst
- Merge Sort: O(n log n) guaranteed
Both Quick Sort and Merge Sort have O(n log n) average case, but Quick Sort has better cache performance and lower constant factors in practice.
Question 3: Operating Systems
What is the primary purpose of virtual memory?
Options:
- (a) To increase RAM speed
- (b) To allow programs to use more memory than physically available
- (c) To replace RAM entirely
- (d) To decrease program execution time
Solution: Virtual memory is a memory management technique that uses hardware and software to allow a computer to compensate for physical memory shortages by temporarily transferring data from RAM to disk storage. This allows programs to use more memory than physically installed RAM.
Question 4: Database Management
Which SQL clause is used to filter groups based on aggregate functions?
Options:
- (a) WHERE
- (b) HAVING
- (c) GROUP BY
- (d) ORDER BY
Solution:
- WHERE filters individual rows before grouping
- HAVING filters groups after aggregation
- GROUP BY creates groups
- ORDER BY sorts results
HAVING is specifically designed to filter groups based on aggregate function results (COUNT, SUM, AVG, etc.).
Question 5: Computer Networks
Which layer of the OSI model is responsible for routing?
Options:
- (a) Data Link Layer
- (b) Network Layer
- (c) Transport Layer
- (d) Session Layer
Solution: The Network Layer (Layer 3) is responsible for logical addressing and routing packets between different networks. It uses IP addresses and routing protocols to determine the best path.
Question 6: Object-Oriented Programming
Which OOP principle is demonstrated when a subclass provides a specific implementation of a method that is already defined in its superclass?
Options:
- (a) Encapsulation
- (b) Inheritance
- (c) Polymorphism
- (d) Abstraction
Solution: Method overriding (runtime polymorphism) occurs when a subclass provides its own implementation of a method inherited from the parent class. This allows different classes to respond differently to the same message.
Question 7: Data Structures
What data structure would be most efficient for implementing an undo feature in a text editor?
Options:
- (a) Queue
- (b) Stack
- (c) Array
- (d) Linked List
Solution: A Stack follows LIFO (Last In First Out) order. Each edit operation is pushed onto the stack, and undo simply pops the most recent operation. This perfectly matches the undo behavior where the last action is undone first.
Question 8: Algorithms
What is the space complexity of the iterative implementation of binary search?
Options:
- (a) O(1)
- (b) O(log n)
- (c) O(n)
- (d) O(n log n)
Solution: Iterative binary search uses only a constant amount of extra space for variables (low, high, mid) regardless of input size. No recursion stack is used.
Question 9: Operating Systems
Which scheduling algorithm can lead to starvation?
Options:
- (a) Round Robin
- (b) First Come First Served
- (c) Shortest Job First
- (d) Multilevel Queue
Solution: Shortest Job First (SJF) prioritizes processes with shorter burst times. Long-running processes may never get CPU time if shorter processes keep arriving, leading to starvation.
Question 10: Web Technologies
What does REST stand for in RESTful APIs?
Options:
- (a) Remote Execution and State Transfer
- (b) Representational State Transfer
- (c) Resource Exchange State Transfer
- (d) Responsive State Transfer
Solution: REST = Representational State Transfer. It's an architectural style for designing networked applications that relies on stateless, client-server communication, typically using HTTP methods (GET, POST, PUT, DELETE).
📚 Verbal/English Questions (10 Questions with Solutions)
Question 1: Synonyms
Choose the word closest in meaning to "EPHEMERAL":
Options:
- (a) Eternal
- (b) Transient
- (c) Permanent
- (d) Stable
Solution: Ephemeral means lasting for a very short time, transient, or fleeting.
Question 2: Antonyms
Choose the word opposite in meaning to "Benevolent":
Options:
- (a) Kind
- (b) Malevolent
- (c) Generous
- (d) Compassionate
Solution: Benevolent means well-meaning and kindly. Malevolent means having or showing a wish to do evil to others.
Question 3: Sentence Correction
Identify the error in: "Each of the students have completed their assignment."
Options:
- (a) Each of the students
- (b) have completed
- (c) their assignment
- (d) No error
Solution: "Each" is a singular subject, so it requires a singular verb "has" instead of "have." Also, "their" should be "his/her" for formal usage, though "their" as a singular pronoun is increasingly accepted.
Question 4: Fill in the Blanks
"The scientist was ______ in her pursuit of knowledge, never letting setbacks ______ her enthusiasm."
Options:
- (a) relentless, dampen
- (b) hesitant, increase
- (c) casual, affect
- (d) doubtful, boost
Solution: The sentence describes someone persistent in their pursuit. "Relentless" fits the first blank (persistent, unceasing), and "dampen" means to make less strong or intense, which fits the context of not letting setbacks reduce enthusiasm.
Question 5: Reading Comprehension
Read the passage and answer:
"Artificial Intelligence has transformed industries worldwide. While concerns about job displacement persist, many experts argue that AI will create more jobs than it eliminates. The key lies in reskilling and adapting to new technological paradigms."
What is the author's main argument?
Options:
- (a) AI will eliminate all jobs
- (b) AI poses no threat to employment
- (c) Adaptation and reskilling are crucial for the AI era
- (d) AI development should be stopped
Solution: The passage acknowledges concerns but emphasizes that reskilling and adaptation are key to navigating the AI transformation.
Question 6: Analogy
"Book" is to "Reading" as "Fork" is to:
Options:
- (a) Cooking
- (b) Eating
- (c) Kitchen
- (d) Food
Solution: A book is a tool used for reading. Similarly, a fork is a tool used for eating.
Question 7: Idioms
What does "to bite the bullet" mean?
Options:
- (a) To avoid a difficult situation
- (b) To face a painful or difficult situation bravely
- (c) To complain about problems
- (d) To cause trouble intentionally
Solution: "Bite the bullet" means to force yourself to do something unpleasant or difficult, or to be brave in a difficult situation. The phrase originates from when patients would bite on bullets during surgery without anesthesia.
Question 8: Spotting Errors
"The committee members were divided in their opinion about the new proposal."
Options:
- (a) The committee members
- (b) were divided
- (c) in their opinion
- (d) No error
Solution: The sentence is grammatically correct. "Divided in their opinion" is a valid expression meaning having different viewpoints.
Question 9: Word Substitution
One who studies the evolution of mankind:
Options:
- (a) Anthropologist
- (b) Archaeologist
- (c) Biologist
- (d) Sociologist
Solution:
- Anthropologist: Studies human societies, cultures, and their development
- Archaeologist: Studies human history through excavation
- Biologist: Studies living organisms
- Sociologist: Studies society and social behavior
Question 10: Rearrangement
Arrange in meaningful order: P: The implementation of the new policy Q: After careful deliberation R: Was announced yesterday S: By the board of directors
Options:
- (a) PQRS
- (b) QPRS
- (c) PQSR
- (d) QPSR
Solution: The correct sequence: "After careful deliberation (Q), the implementation of the new policy (P) was announced yesterday (R) by the board of directors (S)."
🖥️ Coding Questions (5 Questions with Python Solutions)
Question 1: Two Sum
Problem: Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target.
Constraints:
- Each input would have exactly one solution
- You may not use the same element twice
- You can return the answer in any order
Example:
Input: nums = [2, 7, 11, 15], target = 9
Output: [0, 1]
Explanation: nums[0] + nums[1] = 2 + 7 = 9
Python Solution:
def two_sum(nums, target):
"""
Time Complexity: O(n)
Space Complexity: O(n)
"""
seen = {} # value -> index
for i, num in enumerate(nums):
complement = target - num
if complement in seen:
return [seen[complement], i]
seen[num] = i
return [] # No solution found
# Test
print(two_sum([2, 7, 11, 15], 9)) # [0, 1]
print(two_sum([3, 2, 4], 6)) # [1, 2]
print(two_sum([3, 3], 6)) # [0, 1]
Explanation: We use a hash map to store values we've seen. For each number, we check if its complement (target - num) exists in the hash map. If yes, we found our pair. This gives O(n) time complexity.
Question 2: Reverse a Linked List
Problem: Given the head of a singly linked list, reverse the list, and return the reversed list.
Example:
Input: head = [1, 2, 3, 4, 5]
Output: [5, 4, 3, 2, 1]
Python Solution:
class ListNode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
def reverse_list(head):
"""
Time Complexity: O(n)
Space Complexity: O(1)
"""
prev = None
current = head
while current:
next_temp = current.next # Store next
current.next = prev # Reverse the link
prev = current # Move prev forward
current = next_temp # Move current forward
return prev # New head
# Helper to create list from array
def create_list(arr):
dummy = ListNode(0)
current = dummy
for val in arr:
current.next = ListNode(val)
current = current.next
return dummy.next
# Helper to print list
def print_list(head):
values = []
while head:
values.append(head.val)
head = head.next
return values
# Test
head = create_list([1, 2, 3, 4, 5])
reversed_head = reverse_list(head)
print(print_list(reversed_head)) # [5, 4, 3, 2, 1]
Explanation: We iterate through the list, keeping track of the previous node. For each node, we reverse its next pointer to point to the previous node instead of the next node.
Question 3: Maximum Subarray (Kadane's Algorithm)
Problem: Find the contiguous subarray with the largest sum and return its sum.
Example:
Input: nums = [-2, 1, -3, 4, -1, 2, 1, -5, 4]
Output: 6
Explanation: [4, -1, 2, 1] has the largest sum = 6
Python Solution:
def max_subarray(nums):
"""
Kadane's Algorithm
Time Complexity: O(n)
Space Complexity: O(1)
"""
max_current = max_global = nums[0]
for i in range(1, len(nums)):
# Either start new subarray or extend existing
max_current = max(nums[i], max_current + nums[i])
if max_current > max_global:
max_global = max_current
return max_global
# Also return the subarray
def max_subarray_with_indices(nums):
max_current = max_global = nums[0]
start = end = temp_start = 0
for i in range(1, len(nums)):
if nums[i] > max_current + nums[i]:
max_current = nums[i]
temp_start = i
else:
max_current += nums[i]
if max_current > max_global:
max_global = max_current
start = temp_start
end = i
return max_global, nums[start:end+1]
# Test
nums = [-2, 1, -3, 4, -1, 2, 1, -5, 4]
print(max_subarray(nums)) # 6
print(max_subarray_with_indices(nums)) # (6, [4, -1, 2, 1])
Explanation: Kadane's algorithm tracks the maximum sum ending at each position. At each step, we decide whether to extend the previous subarray or start fresh. The key insight is that if the sum becomes negative, it won't help future sums.
Question 4: Merge Intervals
Problem: Given an array of intervals where intervals[i] = [start, end], merge all overlapping intervals.
Example:
Input: intervals = [[1, 3], [2, 6], [8, 10], [15, 18]]
Output: [[1, 6], [8, 10], [15, 18]]
Python Solution:
def merge_intervals(intervals):
"""
Time Complexity: O(n log n) due to sorting
Space Complexity: O(n)
"""
if not intervals:
return []
# Sort by start time
intervals.sort(key=lambda x: x[0])
merged = [intervals[0]]
for current in intervals[1:]:
last = merged[-1]
# Check for overlap
if current[0] <= last[1]:
# Merge: update end to max of both ends
last[1] = max(last[1], current[1])
else:
merged.append(current)
return merged
# Alternative: more explicit
def merge_intervals_v2(intervals):
if not intervals:
return []
intervals.sort()
result = []
start, end = intervals[0]
for s, e in intervals[1:]:
if s <= end: # Overlapping
end = max(end, e)
else: # Non-overlapping
result.append([start, end])
start, end = s, e
result.append([start, end])
return result
# Test
intervals = [[1, 3], [2, 6], [8, 10], [15, 18]]
print(merge_intervals(intervals)) # [[1, 6], [8, 10], [15, 18]]
intervals2 = [[1, 4], [4, 5]]
print(merge_intervals(intervals2)) # [[1, 5]]
Explanation: First sort intervals by start time. Then iterate through, merging when the current interval overlaps with the last merged interval (current.start ≤ last.end).
Question 5: LRU Cache
Problem: Design a data structure that follows the constraints of a Least Recently Used (LRU) cache.
Requirements:
get(key): Return the value if key exists, else -1put(key, value): Update value if key exists, else add. If at capacity, evict least recently used.
Python Solution:
from collections import OrderedDict
class LRUCache:
"""
Time Complexity: O(1) for both get and put
Space Complexity: O(capacity)
"""
def __init__(self, capacity: int):
self.capacity = capacity
self.cache = OrderedDict()
def get(self, key: int) -> int:
if key not in self.cache:
return -1
# Move to end (most recent)
self.cache.move_to_end(key)
return self.cache[key]
def put(self, key: int, value: int) -> None:
if key in self.cache:
self.cache.move_to_end(key)
self.cache[key] = value
if len(self.cache) > self.capacity:
# Pop first item (least recent)
self.cache.popitem(last=False)
# Manual implementation using HashMap + Doubly Linked List
class Node:
def __init__(self, key=0, val=0):
self.key = key
self.val = val
self.prev = None
self.next = None
class LRUCacheManual:
def __init__(self, capacity: int):
self.capacity = capacity
self.cache = {} # key -> node
# Dummy head and tail
self.head = Node()
self.tail = Node()
self.head.next = self.tail
self.tail.prev = self.head
def _remove(self, node):
"""Remove node from linked list"""
prev, nxt = node.prev, node.next
prev.next = nxt
nxt.prev = prev
def _add_to_front(self, node):
"""Add node right after head (most recent)"""
node.prev = self.head
node.next = self.head.next
self.head.next.prev = node
self.head.next = node
def _move_to_front(self, node):
"""Move existing node to front"""
self._remove(node)
self._add_to_front(node)
def _pop_tail(self):
"""Remove and return node before tail (least recent)"""
res = self.tail.prev
self._remove(res)
return res
def get(self, key: int) -> int:
if key not in self.cache:
return -1
node = self.cache[key]
self._move_to_front(node)
return node.val
def put(self, key: int, value: int) -> None:
if key in self.cache:
node = self.cache[key]
node.val = value
self._move_to_front(node)
else:
new_node = Node(key, value)
self.cache[key] = new_node
self._add_to_front(new_node)
if len(self.cache) > self.capacity:
# Evict LRU
lru = self._pop_tail()
del self.cache[lru.key]
# Test
cache = LRUCache(2)
cache.put(1, 1)
cache.put(2, 2)
print(cache.get(1)) # 1
cache.put(3, 3) # evicts key 2
print(cache.get(2)) # -1
cache.put(4, 4) # evicts key 1
print(cache.get(1)) # -1
print(cache.get(3)) # 3
print(cache.get(4)) # 4
Explanation: LRU Cache combines a hash map for O(1) lookups with a doubly linked list for O(1) updates. Most recently used items are at the front, least recent at the back. Python's OrderedDict provides this functionality built-in.
💡 Interview Tips
1. Master Data Structures and Algorithms
Google interviews heavily focus on DSA. Practice arrays, strings, trees, graphs, dynamic programming, and system design daily. Use LeetCode (Medium/Hard), Codeforces, and past Google interview questions.
2. Think Out Loud
Always verbalize your thought process. Interviewers care about how you approach problems, not just the final answer. Explain trade-offs, discuss multiple approaches, and justify your decisions.
3. Write Clean, Bug-Free Code
Google expects production-quality code. Use meaningful variable names, handle edge cases, and test your code mentally before declaring it done. Use Python, Java, C++, or Go - languages Google uses internally.
4. Prepare for System Design (for SDE 2+ roles)
For experienced candidates, system design is crucial. Study distributed systems, database design, caching strategies, load balancing, and microservices. Practice designing YouTube, Twitter, or Uber.
5. Demonstrate Googliness
Google values collaboration, intellectual humility, and user focus. Show that you can work in teams, admit when you don't know something, and always prioritize the user experience.
6. Ask Clarifying Questions
Don't jump into coding immediately. Understand the problem constraints, expected scale, and edge cases. This shows thoroughness and prevents solving the wrong problem.
7. Practice Behavioral Questions Using STAR Method
Prepare stories about leadership, conflict resolution, failures, and achievements using the Situation-Task-Action-Result format. Be specific and quantify your impact.
❓ Frequently Asked Questions
Q1: What is the eligibility criteria for Google campus recruitment 2026?
A: Google typically requires a B.Tech/B.E. or M.Tech/MS/MCA degree with a CGPA of 7.5+ (or 75% and above). Students from CSE, IT, ECE, and related branches are eligible. No active backlogs are allowed at the time of hiring.
Q2: How many rounds are there in Google's hiring process?
A: The typical process includes: (1) Resume Screening, (2) Online Assessment (OA) with 2-4 coding problems, (3) Technical Phone Screen (45-60 mins), (4) Virtual/Onsite rounds (4-5 interviews covering coding, system design, and behavioral/Googliness).
Q3: What programming language should I use for Google interviews?
A: Google prefers languages they use internally: Python, Java, C++, and Go. Choose the one you're most comfortable with, as the focus is on problem-solving, not syntax.
Q4: How should I prepare for Google's System Design interview?
A: Study concepts like load balancing, caching (Redis/Memcached), database sharding, CAP theorem, microservices, message queues, and CDN. Practice designing scalable systems like URL shorteners, chat apps, or video streaming platforms.
Q5: What does "Googliness" mean in interviews?
A: Googliness refers to Google's cultural values: being user-focused, collaborative, intellectually humble, transparent, and having a growth mindset. Show that you can work well with others, accept feedback, and prioritize the greater good over individual achievement.
📖 Additional Resources
- LeetCode: Practice medium/hard problems tagged with "Google"
- GeeksforGeeks: Google interview archives and company-specific preparation
- "Cracking the Coding Interview" by Gayle Laakmann McDowell
- "Elements of Programming Interviews" by Adnan Aziz
- System Design Primer (GitHub)
Good luck with your Google interview preparation! 🚀
Remember: Consistent practice is the key. Start early, stay focused, and believe in yourself.